diff --git a/src/cluster/cluster.cpp b/src/cluster/cluster.cpp
index e7da6b93ad2f1bd4fb51d352bfc6195beecf3d28..1752b6eab69dbe1d9e0fef35529307a474f00d0a 100644
--- a/src/cluster/cluster.cpp
+++ b/src/cluster/cluster.cpp
@@ -536,6 +536,10 @@ void cluster(const string& config_file, const string& data_file, const string& o
       
     delete sconf;
     delete gconf;
+#ifdef USE_MAGMA
+    logger->log("INFO: Process " + to_string(mpidata->rank) + " finalizes MAGMA.\n");
+    magma_finalize();
+#endif
     chrono::time_point<chrono::high_resolution_clock> t_end = chrono::high_resolution_clock::now();
     elapsed = t_end - t_start;
     string message = "INFO: Calculation lasted " + to_string(elapsed.count()) + "s.\n";