From 7f4bd0fcdda4a7135ba56bf190de87851069819d Mon Sep 17 00:00:00 2001
From: Giovanni La Mura <giovanni.lamura@inaf.it>
Date: Tue, 7 May 2024 15:04:42 +0200
Subject: [PATCH] Enable MAGMA-driven cluster calculation

---
 src/cluster/cluster.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/cluster/cluster.cpp b/src/cluster/cluster.cpp
index 422dc193..1460ca44 100644
--- a/src/cluster/cluster.cpp
+++ b/src/cluster/cluster.cpp
@@ -149,6 +149,9 @@ void cluster(const string& config_file, const string& data_file, const string& o
     if (tppoan.is_open()) {
 #ifdef USE_LAPACK
       logger->log("INFO: using LAPACK calls.\n", LOG_INFO);
+#elif defined USE_MAGMA
+      logger->log("INFO: using MAGMA calls.\n", LOG_INFO);
+      magma_init();
 #else
       logger->log("INFO: using fall-back lucin() calls.\n", LOG_INFO);
 #endif
@@ -280,9 +283,12 @@ void cluster(const string& config_file, const string& data_file, const string& o
 #endif
       tppoanp->close();
       delete tppoanp;
+#ifdef USE_MAGMA
+      magma_finalize();
+#endif
     } else { // In case TPPOAN could not be opened. Should never happen.
       logger->err("\nERROR: failed to open TPPOAN file.\n");
-    }
+    } // closes if (tppoan.is_open) ... else ...
     fclose(output);
     // Clean memory
     delete cid;
-- 
GitLab