Disable fastmath with OpenCL on Intel devices
authorAndrey Alekseenko <al42and@gmail.com>
Wed, 3 Nov 2021 09:50:16 +0000 (09:50 +0000)
committerAndrey Alekseenko <al42and@gmail.com>
Wed, 3 Nov 2021 09:50:16 +0000 (09:50 +0000)
Refs #3898

docs/user-guide/environment-variables.rst
src/gromacs/gpu_utils/ocl_compiler.cpp

index 026654d36988a1309164adcebbd62c3573a7bb68..1698fcedb260d307b15f8c9c182f17e920165895 100644 (file)
@@ -423,6 +423,7 @@ compilation of OpenCL kernels, but they are also used in device selection.
 
 ``GMX_OCL_DISABLE_FASTMATH``
         Prevents the use of ``-cl-fast-relaxed-math`` compiler option.
+        Not: fast math is always disabled on Intel devices due to instability.
 
 ``GMX_OCL_DUMP_LOG``
         If defined, the OpenCL build log is always written to the
@@ -442,8 +443,8 @@ compilation of OpenCL kernels, but they are also used in device selection.
         ``GMX_OCL_NOGENCACHE``).
 
             - NVIDIA GPUs: PTX code is saved in the current directory
-             with the name ``device_name.ptx``
-           - AMD GPUs: ``.IL/.ISA`` files will be created for each OpenCL
+              with the name ``device_name.ptx``
+            - AMD GPUs: ``.IL/.ISA`` files will be created for each OpenCL
               kernel built.  For details about where these files are
               created check AMD documentation for ``-save-temps`` compiler
               option.
index 5f826e5e0ab334dffe87b54d5a26e7ddb4b2ca96..64e925b885036f74e01a9dd2049f2d790cbb5a9a 100644 (file)
@@ -169,8 +169,9 @@ static std::string selectCompilerOptions(DeviceVendor deviceVendor)
         compilerOptions += " -cl-opt-disable";
     }
 
-    /* Fastmath improves performance on all supported arch */
-    if (getenv("GMX_OCL_DISABLE_FASTMATH") == nullptr)
+    /* Fastmath improves performance on all supported arch,
+     * but is tends to cause problems on Intel (Issue #3898) */
+    if ((deviceVendor != DeviceVendor::Intel) && (getenv("GMX_OCL_DISABLE_FASTMATH") == nullptr))
     {
         compilerOptions += " -cl-fast-relaxed-math";