From 8476611341a37ca2782dcf9b55b3077c117f5ff3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Szil=C3=A1rd=20P=C3=A1ll?= Date: Thu, 24 Sep 2020 12:44:09 +0000 Subject: [PATCH] Improve OpenCL log/error reporting Improve reporting by making messages more specific; also added logging of binary caching also for the case where a cache files is found in addition to the case where no cache file is present --- src/gromacs/gpu_utils/ocl_caching.cpp | 4 ++-- src/gromacs/gpu_utils/ocl_compiler.cpp | 6 +++++- src/gromacs/nbnxm/opencl/nbnxm_ocl_jit_support.cpp | 5 +++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/gromacs/gpu_utils/ocl_caching.cpp b/src/gromacs/gpu_utils/ocl_caching.cpp index 18074556d6..e8894aaad0 100644 --- a/src/gromacs/gpu_utils/ocl_caching.cpp +++ b/src/gromacs/gpu_utils/ocl_caching.cpp @@ -139,8 +139,8 @@ cl_program makeProgramFromCache(const std::string& filename, cl_context context, nullptr, &cl_error); if (cl_error != CL_SUCCESS) { - GMX_THROW(InternalError("Could not create OpenCL program, error was " - + ocl_get_error_string(cl_error))); + GMX_THROW(InternalError("Could not create OpenCL program from the cache file " + filename + + ", error was " + ocl_get_error_string(cl_error))); } return program; diff --git a/src/gromacs/gpu_utils/ocl_compiler.cpp b/src/gromacs/gpu_utils/ocl_compiler.cpp index d2dc183566..1f670e8b91 100644 --- a/src/gromacs/gpu_utils/ocl_compiler.cpp +++ b/src/gromacs/gpu_utils/ocl_compiler.cpp @@ -450,11 +450,15 @@ cl_program compileProgram(FILE* fplog, // Failing to read from the cache is not a critical error formatExceptionMessageToFile(fplog, e); } + fprintf(fplog, "OpenCL binary cache file %s is present, will load kernels.\n", + cacheFilename.c_str()); } else { fprintf(fplog, - "No OpenCL binary cache file was present, so will compile kernels normally.\n"); + "No OpenCL binary cache file was present for %s, so will compile kernels " + "normally.\n", + kernelBaseFilename.c_str()); } } if (program == nullptr) diff --git a/src/gromacs/nbnxm/opencl/nbnxm_ocl_jit_support.cpp b/src/gromacs/nbnxm/opencl/nbnxm_ocl_jit_support.cpp index ad6e1164b5..40eb905184 100644 --- a/src/gromacs/nbnxm/opencl/nbnxm_ocl_jit_support.cpp +++ b/src/gromacs/nbnxm/opencl/nbnxm_ocl_jit_support.cpp @@ -207,8 +207,9 @@ void nbnxn_gpu_compile_kernels(NbnxmGpu* nb) } catch (gmx::GromacsException& e) { - e.prependContext(gmx::formatString("Failed to compile NBNXN kernels for GPU #%s\n", - nb->deviceContext_->deviceInfo().device_name)); + e.prependContext(gmx::formatString( + "Failed to compile/load nbnxm kernels for GPU #%d %s\n", + nb->deviceContext_->deviceInfo().id, nb->deviceContext_->deviceInfo().device_name)); throw; } } -- 2.22.0