made errors during GPU detection non-fatal
[alexxy/gromacs.git] / src / gmxlib / gmx_detect_hardware.c
index 6fe77d759ef9f8e3a9f5fd847b4c53172daafac3..655169cfa5a644bcae76f9003ce35be96d3702c3 100644 (file)
@@ -487,7 +487,23 @@ void gmx_detect_hardware(FILE *fplog, gmx_hw_info_t *hwinfo,
     /* run the detection if the binary was compiled with GPU support */
     if (bGPUBin && getenv("GMX_DISABLE_GPU_DETECTION")==NULL)
     {
-        detect_cuda_gpus(&hwinfo->gpu_info);
+        char detection_error[STRLEN];
+
+        if (detect_cuda_gpus(&hwinfo->gpu_info, detection_error) != 0)
+        {
+            if (detection_error != NULL && detection_error[0] != '\0')
+            {
+                sprintf(sbuf, ":\n      %s\n", detection_error);
+            }
+            else
+            {
+                sprintf(sbuf, ".");
+            }
+            md_print_warn(cr, fplog,
+                          "NOTE: Error occurred during GPU detection%s"
+                          "      Can not use GPU acceleration, will fall back to CPU kernels.\n",
+                          sbuf);
+        }
     }
 
     if (bForceUseGPU || bTryUseGPU)