Commit 2c267b9c authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Disable separate CUDA and MAGMA logging

parent 8bc86876
Loading
Loading
Loading
Loading
+0 −21
Original line number Diff line number Diff line
@@ -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;