From 8daff31c6ee889375914b20ca3a01ed9dbf3e01f Mon Sep 17 00:00:00 2001 From: Mark Abraham Date: Wed, 13 Jun 2018 09:24:45 +0200 Subject: [PATCH] Fix premature reporting of action when GPUs are not detected 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 | 4 ++-- src/gromacs/gpu_utils/gpu_utils.h | 7 ++++++- src/gromacs/hardware/detecthardware.cpp | 8 ++++---- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/gromacs/gpu_utils/gpu_utils.cu b/src/gromacs/gpu_utils/gpu_utils.cu index 7660d7cc24..ed4d7e06cd 100644 --- a/src/gromacs/gpu_utils/gpu_utils.cu +++ b/src/gromacs/gpu_utils/gpu_utils.cu @@ -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)); } diff --git a/src/gromacs/gpu_utils/gpu_utils.h b/src/gromacs/gpu_utils/gpu_utils.h index 9634c38034..01404a9644 100644 --- a/src/gromacs/gpu_utils/gpu_utils.h +++ b/src/gromacs/gpu_utils/gpu_utils.h @@ -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. * diff --git a/src/gromacs/hardware/detecthardware.cpp b/src/gromacs/hardware/detecthardware.cpp index f72237eab6..10d8a229ea 100644 --- a/src/gromacs/hardware/detecthardware.cpp +++ b/src/gromacs/hardware/detecthardware.cpp @@ -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()); } } -- 2.22.0