From 13122790bfe398aa4bcecf5d0f4f4bb2568bd177 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Szil=C3=A1rd=20P=C3=A1ll?= Date: Mon, 30 May 2016 21:51:10 +0200 Subject: [PATCH] Add env. var. to enable OpenCL caching OpenCL binary caching is disabled by default (due to concurrency and versions not being safely handled), but during development, being able to avoid the kernel compilation overhead can speed up testing and benchmarking tremendously. This change adds an environment variable that can be used to manually trigger binary caching. Change-Id: I5879acf040216ad75dbb54e7ecec001aae8af8a5 --- docs/user-guide/environment-variables.rst | 5 +++++ src/gromacs/gpu_utils/ocl_compiler.cpp | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/user-guide/environment-variables.rst b/docs/user-guide/environment-variables.rst index b51e252b91..04fc25ba13 100644 --- a/docs/user-guide/environment-variables.rst +++ b/docs/user-guide/environment-variables.rst @@ -367,6 +367,11 @@ compilation of OpenCL kernels, but they are also used in device selection. kernels from previous runs. Currently, caching is always disabled, until we solve concurrency issues. +``GMX_OCL_GENCACHE`` + Enable OpenCL binary caching. Only intended to be used for + development and (expert) testing as neither concurrency + nor cache invalidation is implemented safely! + ``GMX_OCL_NOFASTGEN`` If set, generate and compile all algorithm flavors, otherwise only the flavor required for the simulation is generated and diff --git a/src/gromacs/gpu_utils/ocl_compiler.cpp b/src/gromacs/gpu_utils/ocl_compiler.cpp index 99470907d6..b4b753876c 100644 --- a/src/gromacs/gpu_utils/ocl_compiler.cpp +++ b/src/gromacs/gpu_utils/ocl_compiler.cpp @@ -72,8 +72,9 @@ namespace ocl /*! \brief True if OpenCL binary caching is enabled. * - * Currently caching is disabled until we resolve concurrency issues. */ -static bool useBuildCache = false; // (NULL == getenv("GMX_OCL_NOGENCACHE")); + * Currently caching is disabled by default unless the env var override + * is used until we resolve concurrency issues. */ +static bool useBuildCache = getenv("GMX_OCL_GENCACHE"); // (NULL == getenv("GMX_OCL_NOGENCACHE")); /*! \brief Handles writing the OpenCL JIT compilation log to \c fplog. * -- 2.11.4.GIT