X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?p=alexxy%2Fgromacs.git;a=blobdiff_plain;f=src%2Fgromacs%2Fgpu_utils%2Fgpu_utils.cpp;fp=src%2Fgromacs%2Fgpu_utils%2Fgpu_utils.cpp;h=2d8846caa334f827ad6c3ed6846b87694a0c4b17;hp=501d6b625fc8ff9b0aeea6478e64c232e9950a78;hb=c04377fde97785e4fa02bf229b56a67345271be7;hpb=0ce1837c232fa3e99ca90ce12ccb510e0b9a9ba2 diff --git a/src/gromacs/gpu_utils/gpu_utils.cpp b/src/gromacs/gpu_utils/gpu_utils.cpp index 501d6b625f..2d8846caa3 100644 --- a/src/gromacs/gpu_utils/gpu_utils.cpp +++ b/src/gromacs/gpu_utils/gpu_utils.cpp @@ -59,3 +59,26 @@ const char* enumValueToString(GpuApiCallBehavior enumValue) }; 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; + } +}