Fix premature reporting of action when GPUs are not detected
authorMark Abraham <mark.j.abraham@gmail.com>
Wed, 13 Jun 2018 07:24:45 +0000 (09:24 +0200)
committerMark Abraham <mark.j.abraham@gmail.com>
Wed, 13 Jun 2018 15:56:48 +0000 (17:56 +0200)
The decision about what to do when GPUs could not be detected is a
responsbility taken at a higher level, so the detection handling code
should just report the facts.

Clarified some of the intended usage in the documentation

Fixes #2374

Change-Id: I63b569e053dd88d66351640019efc758e91bbdff

src/gromacs/gpu_utils/gpu_utils.cu
src/gromacs/gpu_utils/gpu_utils.h
src/gromacs/hardware/detecthardware.cpp

index 7660d7cc249315dd5b2571a89c01ab862ae106c0..ed4d7e06cdb314e156c2a1cc2e9933dba63a1780 100644 (file)
@@ -680,8 +680,8 @@ bool canDetectGpus(std::string *errorMessage)
              * something wrong with the machine: driver-runtime
              * mismatch, all GPUs being busy in exclusive mode,
              * invalid CUDA_VISIBLE_DEVICES, or some other condition
-             * which should result in GROMACS issuing a warning a
-             * falling back to CPUs. */
+             * which should result in GROMACS issuing at least a
+             * warning. */
             errorMessage->assign(cudaGetErrorString(stat));
         }
 
index 9634c380343e97ea0b0531dbcdf9c70627f78bb0..01404a964484caaf900c93aca842ab1e92683de4 100644 (file)
@@ -80,7 +80,12 @@ enum class GpuTaskCompletion
  * Returns true when this is a build of \Gromacs configured to support
  * GPU usage, and a valid device driver, ICD, and/or runtime was detected.
  *
- * \param[out] errorMessage  When returning false and non-nullptr was passed,
+ * This function is not intended to be called from build
+ * configurations that do not support GPUs, and there will be no
+ * descriptive message in that case.
+ *
+ * \param[out] errorMessage  When returning false on a build configured with
+ *                           GPU support and non-nullptr was passed,
  *                           the string contains a descriptive message about
  *                           why GPUs cannot be detected.
  *
index f72237eab67ebfe9328168d1a4505161528b5bb7..10d8a229ea7734747054fa6c8804532a5ddbdb1c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -167,9 +167,9 @@ static void gmx_detect_gpus(const gmx::MDLogger &mdlog, const t_commrec *cr)
         if (!gpusCanBeDetected)
         {
             GMX_LOG(mdlog.warning).asParagraph().appendTextFormatted(
-                    "NOTE: GPUs cannot be detected:\n"
-                    "      %s\n"
-                    "      Can not use GPU acceleration, will fall back to CPU kernels.",
+                    "NOTE: Detection of GPUs failed. The API reported:\n"
+                    "      %s\n",
+                    "      GROMACS cannot run tasks on a GPU.",
                     errorMessage.c_str());
         }
     }