From 2c267b9cd436e3d467e7fbadd6a0ddb3c19bade4 Mon Sep 17 00:00:00 2001
From: Giovanni La Mura <giovanni.lamura@inaf.it>
Date: Thu, 16 May 2024 17:58:59 +0200
Subject: [PATCH] Disable separate CUDA and MAGMA logging

---
 src/cluster/cluster.cpp | 21 ---------------------
 1 file changed, 21 deletions(-)

diff --git a/src/cluster/cluster.cpp b/src/cluster/cluster.cpp
index 831242bc..ca17674e 100644
--- a/src/cluster/cluster.cpp
+++ b/src/cluster/cluster.cpp
@@ -95,28 +95,15 @@ void cluster(const string& config_file, const string& data_file, const string& o
   cudaGetDeviceCount(&device_count);
   logger->log("DEBUG: Proc-" + to_string(mpidata->rank) + " found " + to_string(device_count) + " CUDA devices.\n", LOG_DEBG);
   logger->log("INFO: Process " + to_string(mpidata->rank) + " initializes MAGMA.\n");
-  magma_device_t *magmadevices = new magma_device_t[device_count];
-  int *cudadevices = new int[device_count];
-  cudaSetValidDevices(cudadevices, device_count);
-  for (int ci=0; ci<device_count; ci++) magmadevices[ci] = (magma_device_t) cudadevices[ci];
-  magma_int_t num_devices;
-  magma_getdevices(magmadevices, device_count, &num_devices);
-  logger->log("DEBUG: Proc-" + to_string(mpidata->rank) + " found " + to_string(num_devices) + " MAGMA devices.\n", LOG_DEBG);
   magma_int_t magma_result = magma_init();
   if (magma_result != MAGMA_SUCCESS) {
     logger->err("ERROR: Process " + to_string(mpidata->rank) + " failed to initilize MAGMA.\n");
     logger->err("PROC-" + to_string(mpidata->rank) + ": MAGMA error code " + to_string(magma_result) + "\n");
     fclose(timing_file);
-    delete[] magmadevices;
-    delete[] cudadevices;
     delete time_logger;
     delete logger;
     return;
   }
-#else
-  int *cudadevices = new int[1];
-  int *magmadevices = new int[1];
-  cudadevices[0] = magmadevices[0] = -1;
 #endif
   // the following only happens on MPI process 0
   if (mpidata->rank == 0) {
@@ -129,8 +116,6 @@ void cluster(const string& config_file, const string& data_file, const string& o
       string message = "FILE: " + string(ex.what()) + "\n";
       logger->err(message);
       fclose(timing_file);
-      delete[] cudadevices;
-      delete[] magmadevices;
       delete time_logger;
       delete logger;
       return;
@@ -147,8 +132,6 @@ void cluster(const string& config_file, const string& data_file, const string& o
       logger->err(message);
       if (sconf) delete sconf;
       fclose(timing_file);
-      delete[] cudadevices;
-      delete[] magmadevices;
       delete time_logger;
       delete logger;
       return;
@@ -254,8 +237,6 @@ void cluster(const string& config_file, const string& data_file, const string& o
 	  tppoan.close();
 	  fclose(timing_file);
 	  fclose(output);
-	  delete[] magmadevices;
-	  delete[] cudadevices;
 	  delete p_scattering_angles;
 	  delete cid;
 	  delete logger;
@@ -565,8 +546,6 @@ void cluster(const string& config_file, const string& data_file, const string& o
       }
     }
     // Clean memory
-    delete[] magmadevices;
-    delete[] cudadevices;
     delete cid;
     delete p_scattering_angles;
     delete sconf;
-- 
GitLab