From 244bd973cedb192dffc9f0cacb84767f4f91dbdb Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-braunschweig.de>
Date: Wed, 14 Jun 2023 10:41:53 +0200
Subject: [PATCH] Log device number for cuda devices

---
 regression-tests/multigpu_test/rocket4GPU.yml |  3 +--
 regression-tests/multigpu_test/rocket8GPU.yml |  3 +--
 src/cuda/DeviceInfo.cpp                       | 12 ++++++------
 3 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/regression-tests/multigpu_test/rocket4GPU.yml b/regression-tests/multigpu_test/rocket4GPU.yml
index 2de1602cd..a7ece0557 100755
--- a/regression-tests/multigpu_test/rocket4GPU.yml
+++ b/regression-tests/multigpu_test/rocket4GPU.yml
@@ -45,8 +45,7 @@ collect:
     overwrite: true
 
 clean:
-  - multigpu_test/output/*
-  - multigpu_test/src/*
+  - multigpu_test/*
 
 sbatch: multigpu_test/slurm4GPU.job
 continue_if_job_fails: true
diff --git a/regression-tests/multigpu_test/rocket8GPU.yml b/regression-tests/multigpu_test/rocket8GPU.yml
index 29f06e919..76203eb9d 100755
--- a/regression-tests/multigpu_test/rocket8GPU.yml
+++ b/regression-tests/multigpu_test/rocket8GPU.yml
@@ -46,8 +46,7 @@ collect:
     overwrite: true
 
 clean:
-  - multigpu_test/output/*
-  - multigpu_test/src/*
+  - multigpu_test/*
 
 sbatch: multigpu_test/slurm8GPU.job
 continue_if_job_fails: true
diff --git a/src/cuda/DeviceInfo.cpp b/src/cuda/DeviceInfo.cpp
index 20ea2c4f6..e4fe15ed8 100644
--- a/src/cuda/DeviceInfo.cpp
+++ b/src/cuda/DeviceInfo.cpp
@@ -15,7 +15,7 @@ void verifyNumberOfDevices(int deviceId)
     int device_count = 0;
     cudaError_t errorId = cudaGetDeviceCount(&device_count);
     if(errorId != cudaSuccess) {
-        VF_LOG_CRITICAL("Error while accessing the device count: {}", cudaGetErrorString(errorId));
+        VF_LOG_CRITICAL("Device {}: Error while accessing the device count: {}", deviceId, cudaGetErrorString(errorId));
     }
     if (deviceId > device_count) {
         throw std::runtime_error("chosen gpudevice >=  device_count ... exiting\n");
@@ -28,13 +28,13 @@ void verifyComputeCapability(int deviceId)
     cudaError_t errorId = cudaGetDeviceProperties(&deviceProp, deviceId);
 
     if(errorId != cudaSuccess){
-        VF_LOG_CRITICAL("Error while accessing the device properties occurs: {}", cudaGetErrorString(errorId));
+        VF_LOG_CRITICAL("Device {}: Error while accessing the device properties occurs: {}", deviceId, cudaGetErrorString(errorId));
     }
 
     VF_LOG_INFO("[compute capability] = [{}.{}]\n", deviceProp.major, deviceProp.minor);
 
     if (deviceProp.major > 999) {
-        throw std::runtime_error("warning, CUDA Device Emulation (CPU) detected, exiting\n");
+        throw std::runtime_error("Warning, CUDA Device Emulation (CPU) detected, exiting\n");
     }
 }
 
@@ -43,13 +43,13 @@ void setCudaDevice(int deviceId)
     // choose a cuda device for kernel execution
     cudaError_t errorId = cudaSetDevice(deviceId);
     if (errorId != cudaSuccess) {
-        VF_LOG_CRITICAL("Error while setting the device to {}: {}", deviceId, cudaGetErrorString(errorId));
+        VF_LOG_CRITICAL("Device {}: Error while setting the device to: {}", deviceId, cudaGetErrorString(errorId));
     } else {
         int device;
         // double check that device was properly selected
         errorId = cudaGetDevice(&device);
         if(errorId != cudaSuccess) {
-            VF_LOG_CRITICAL("Error while getting the device: {}", cudaGetErrorString(errorId));
+            VF_LOG_CRITICAL("Device {}: Error while getting the device: {}", deviceId, cudaGetErrorString(errorId));
         }
     }
 }
@@ -70,7 +70,7 @@ void printCudaInformation(int deviceId)
     cudaError_t errorId = cudaGetDeviceProperties(&prop, deviceId);
 
     if(errorId != cudaSuccess){
-        VF_LOG_CRITICAL("Error while accessing the device properties occurs: {}", cudaGetErrorString(errorId));
+        VF_LOG_CRITICAL("Device {}: Error while accessing the device properties for occurs: {}", deviceId, cudaGetErrorString(errorId));
     }
 
     printf(" --- General Information for device %d ---\n", deviceId);
-- 
GitLab