files. Set to 0 for quiet operation.
``GMX_ENABLE_GPU_TIMING``
- Enables GPU timings in the log file for CUDA. Note that CUDA timings
- are incorrect with multiple streams, as happens with domain
+ Enables GPU timings in the log file for CUDA and SYCL. Note that CUDA
+ timings are incorrect with multiple streams, as happens with domain
decomposition or with both non-bondeds and PME on the GPU (this is
also the main reason why they are not turned on by default).
``GMX_DISABLE_GPU_TIMING``
timing of asynchronously executed GPU operations can have a
non-negligible overhead with short step times. Disabling timing can improve performance in these cases.
+ Timings are disabled by default with CUDA and SYCL.
``GMX_DISABLE_GPU_DETECTION``
when set, disables GPU detection even if :ref:`gmx mdrun` was compiled
};
return s_gpuApiCallBehaviorNames[enumValue];
}
+
+bool decideGpuTimingsUsage()
+{
+ if (GMX_GPU_CUDA || GMX_GPU_SYCL)
+ {
+ /* CUDA: timings are incorrect with multiple streams.
+ * This is the main reason why they are disabled by default.
+ * TODO: Consider turning on by default when we can detect nr of streams.
+ *
+ * SYCL: compilers and runtimes change rapidly, so we disable timings by default
+ * to avoid any possible overhead. */
+ return (getenv("GMX_ENABLE_GPU_TIMING") != nullptr);
+ }
+ else if (GMX_GPU_OPENCL)
+ {
+ return (getenv("GMX_DISABLE_GPU_TIMING") == nullptr);
+ }
+ else
+ {
+ // CPU-only build
+ return false;
+ }
+}
void setupGpuDevicePeerAccess(const std::vector<int>& CUDA_FUNC_ARGUMENT(gpuIdsToUse),
const gmx::MDLogger& CUDA_FUNC_ARGUMENT(mdlog)) CUDA_FUNC_TERM;
+/*! \brief Check the platform-defaults and environment variable to decide whether GPU timings
+ * should be enabled.
+ *
+ * Currently, timings are enabled for OpenCL, but disabled for CUDA and SYCL. This can be overridden
+ * by \c GMX_ENABLE_GPU_TIMING and \c GMX_DISABLE_GPU_TIMING environment variables.
+ */
+bool decideGpuTimingsUsage();
+
#endif
int deviceId = -1;
DeviceInformation* deviceInfo = gpuTaskAssignments.initDevice(&deviceId);
- // timing enabling - TODO put this in gpu_utils (even though generally this is just option handling?)
- bool useTiming = true;
-
- if (GMX_GPU_CUDA)
- {
- /* WARNING: CUDA timings are incorrect with multiple streams.
- * This is the main reason why they are disabled by default.
- */
- // TODO: Consider turning on by default when we can detect nr of streams.
- useTiming = (getenv("GMX_ENABLE_GPU_TIMING") != nullptr);
- }
- else if (GMX_GPU_OPENCL)
- {
- useTiming = (getenv("GMX_DISABLE_GPU_TIMING") == nullptr);
- }
-
// TODO Currently this is always built, yet DD partition code
// checks if it is built before using it. Probably it should
// become an MDModule that is made only when another module
{
dd_setup_dlb_resource_sharing(cr, deviceId);
}
- deviceStreamManager = std::make_unique<DeviceStreamManager>(
- *deviceInfo, havePPDomainDecomposition(cr), runScheduleWork.simulationWork, useTiming);
+ const bool useGpuTiming = decideGpuTimingsUsage();
+ deviceStreamManager = std::make_unique<DeviceStreamManager>(
+ *deviceInfo, havePPDomainDecomposition(cr), runScheduleWork.simulationWork, useGpuTiming);
}
// If the user chose a task assignment, give them some hints
nb->timers = new Nbnxm::GpuTimers();
snew(nb->timings, 1);
- /* WARNING: CUDA timings are incorrect with multiple streams.
- * This is the main reason why they are disabled by default.
- * Can be enabled by setting GMX_ENABLE_GPU_TIMING environment variable.
- * TODO: Consider turning on by default when we can detect nr of streams.
- *
- * OpenCL timing is enabled by default and can be disabled by
- * GMX_DISABLE_GPU_TIMING environment variable.
- *
- * Timing is disabled in SYCL.
- */
- nb->bDoTime = (GMX_GPU_CUDA && (getenv("GMX_ENABLE_GPU_TIMING") != nullptr))
- || (GMX_GPU_OPENCL && (getenv("GMX_DISABLE_GPU_TIMING") == nullptr));
+ nb->bDoTime = decideGpuTimingsUsage();
if (nb->bDoTime)
{