From b9e8608369585af08ed552df030cd586358aa36f Mon Sep 17 00:00:00 2001 From: Andrey Alekseenko Date: Mon, 28 Sep 2020 15:35:39 +0000 Subject: [PATCH] Fix error in ensureReferenceCount We were overwriting input value and comparing it to itself. --- src/gromacs/gpu_utils/cudautils.cuh | 2 +- src/gromacs/gpu_utils/oclutils.h | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gromacs/gpu_utils/cudautils.cuh b/src/gromacs/gpu_utils/cudautils.cuh index babbfaace6..d03768a04b 100644 --- a/src/gromacs/gpu_utils/cudautils.cuh +++ b/src/gromacs/gpu_utils/cudautils.cuh @@ -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"); diff --git a/src/gromacs/gpu_utils/oclutils.h b/src/gromacs/gpu_utils/oclutils.h index dca575367a..26f507f941 100644 --- a/src/gromacs/gpu_utils/oclutils.h +++ b/src/gromacs/gpu_utils/oclutils.h @@ -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 } -- 2.22.0