Improve OpenCL log/error reporting
authorSzilárd Páll <pall.szilard@gmail.com>
Thu, 24 Sep 2020 12:44:09 +0000 (12:44 +0000)
committerMark Abraham <mark.j.abraham@gmail.com>
Thu, 24 Sep 2020 12:44:09 +0000 (12:44 +0000)
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
src/gromacs/gpu_utils/ocl_compiler.cpp
src/gromacs/nbnxm/opencl/nbnxm_ocl_jit_support.cpp

index 18074556d69bd9eeb9025c4bac05e023dea70c4c..e8894aaad00b87eabd966f53695e9601ddb71b8a 100644 (file)
@@ -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;
index d2dc183566d1b91c55ff5e8d5d07d0c613d5f018..1f670e8b910e26d6d4624ded3bf8b451ed76b9c8 100644 (file)
@@ -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)
index ad6e1164b5077c338515a2f328b0d251c25eb261..40eb905184bd1c5ae2405639f5a288f76b818b78 100644 (file)
@@ -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;
         }
     }