Fix error in ensureReferenceCount
authorAndrey Alekseenko <al42and@gmail.com>
Mon, 28 Sep 2020 15:35:39 +0000 (15:35 +0000)
committerArtem Zhmurov <zhmurov@gmail.com>
Mon, 28 Sep 2020 15:35:39 +0000 (15:35 +0000)
We were overwriting input value and comparing it to itself.

src/gromacs/gpu_utils/cudautils.cuh
src/gromacs/gpu_utils/oclutils.h

index babbfaace6b7b0afa094431d256df85d3709107a..d03768a04b949011e523ca0067f37ddcf68c1f70 100644 (file)
@@ -174,7 +174,7 @@ static inline bool haveStreamTasksCompleted(const DeviceStream& deviceStream)
         return false;
     }
 
-    GMX_ASSERT(stat != cudaErrorInvalidResourceHandle, "Stream idnetifier not valid");
+    GMX_ASSERT(stat != cudaErrorInvalidResourceHandle, "Stream identifier not valid");
 
     // cudaSuccess and cudaErrorNotReady are the expected return values
     CU_RET_ERR(stat, "Unexpected cudaStreamQuery failure");
index dca575367a822453aed1c4e8c5b936c0f925e6f0..26f507f9411a9c22507c95971c96f2c4c69104e5 100644 (file)
@@ -80,15 +80,16 @@ void pfree(void* h_ptr);
 std::string ocl_get_error_string(cl_int error);
 
 //! A debug checker to track cl_events being released correctly
-inline void ensureReferenceCount(const cl_event& event, unsigned int refCount)
+inline void ensureReferenceCount(const cl_event& event, unsigned int expectedRefCount)
 {
 #ifndef NDEBUG
+    cl_uint refCount;
     cl_int clError = clGetEventInfo(event, CL_EVENT_REFERENCE_COUNT, sizeof(refCount), &refCount, nullptr);
     GMX_ASSERT(CL_SUCCESS == clError, ocl_get_error_string(clError).c_str());
-    GMX_ASSERT(refCount == refCount, "Unexpected reference count");
+    GMX_ASSERT(refCount == expectedRefCount, "Unexpected reference count");
 #else
     GMX_UNUSED_VALUE(event);
-    GMX_UNUSED_VALUE(refCount);
+    GMX_UNUSED_VALUE(expectedRefCount);
 #endif
 }