Improve error reporting for new CUDA PME device polling 46/4746/1
authorJim Phillips <jim@ks.uiuc.edu>
Mon, 29 Oct 2018 18:58:13 +0000 (13:58 -0500)
committerJim Phillips <jim@ks.uiuc.edu>
Mon, 29 Oct 2018 18:58:13 +0000 (13:58 -0500)
Call cudaDie with a useful message rather than NAMD_bug.

Change-Id: Ibcbc4365055367678a05e76fa5830653c923146c

src/CudaPmeSolverUtil.C

index 1549356..523dd65 100644 (file)
@@ -353,11 +353,17 @@ void CudaPmeKSpaceCompute::energyAndVirialCheck(void *arg, double walltime) {
     // Event has not occurred
     c->checkCount++;
     if (c->checkCount >= 1000000) {
-      NAMD_bug("CudaPmeKSpaceCompute::energyAndVirialCheck, check count exceeded");
+      char errmsg[256];
+      sprintf(errmsg,"CudaPmeKSpaceCompute::energyAndVirialCheck polled %d times",
+              c->checkCount);
+      cudaDie(errmsg,err);
     }
   } else {
     // Anything else is an error
-    NAMD_bug("CudaPmeKSpaceCompute::energyAndVirialCheck, cudaEventQuery returned error");
+    char errmsg[256];
+    sprintf(errmsg,"in CudaPmeKSpaceCompute::energyAndVirialCheck after polling %d times",
+            c->checkCount);
+    cudaDie(errmsg,err);
   }
 
   // Call again 
@@ -523,11 +529,17 @@ void CudaPmeRealSpaceCompute::cuda_gatherforce_check(void *arg, double walltime)
     // Event has not occurred
     c->checkCount++;
     if (c->checkCount >= 1000000) {
-      NAMD_bug("CudaPmeRealSpaceCompute::cuda_gatherforce_check, check count exceeded");
+      char errmsg[256];
+      sprintf(errmsg,"CudaPmeRealSpaceCompute::cuda_gatherforce_check polled %d times",
+              c->checkCount);
+      cudaDie(errmsg,err);
     }
   } else {
     // Anything else is an error
-    NAMD_bug("CudaPmeRealSpaceCompute::cuda_gatherforce_check, cudaEventQuery returned error");
+    char errmsg[256];
+    sprintf(errmsg,"in CudaPmeRealSpaceCompute::cuda_gatherforce_check after polling %d times",
+            c->checkCount);
+    cudaDie(errmsg,err);
   }
 
   // Call again