Consolidate and fix logic for mdrun -nb and -gpuid
commitb9a8c49d8f63a5b6130c944b1bfa5d4dedfd354e
authorMark Abraham <mark.j.abraham@gmail.com>
Wed, 21 Jun 2017 22:10:13 +0000 (22 00:10 +0200)
committerMark Abraham <mark.j.abraham@gmail.com>
Thu, 22 Jun 2017 18:14:04 +0000 (22 20:14 +0200)
tree866d84b7e32ba3cf49453dcec15a9965ea1586c7
parent86729b89f16ae9c5bbc1dbe912e225e2f63c16d6
Consolidate and fix logic for mdrun -nb and -gpuid

Several aspects of task assignment did not work as well as it should.

If gmx mdrun -gpu_id 01 is intended specify that work run on those
GPUs, then e.g. if the tpr uses the Group scheme, then mdrun should
refuse to run, just like it does for mdrun -nb gpu. Now it does
refuse.

gmx mdrun -nb cpu -gpu_id 01 should always give a fatal error, and now
does.

CUDA_VISIBLE_DEVICES="" gmx mdrun -nb gpu and the same with -gpu_id
should give a fatal error, and now does.

After this change, if the user has required short-ranged work on a GPU
with -nb gpu, or made an explicit GPU task assignment with -gpu_id
without using -nb cpu, exit quickly unless GPU support is compiled,
the Verlet scheme is active, and GPUs were found.

Introduced a helper function for whether compatible GPUs have been
found, to help improve encapsulation and readability.

Removed hack from mdrun integration tests that coped with early
implementations of -gpu_id, which is no longer needed.

Fixes #2067

Change-Id: Ic5091edc892b0fcb0371720a5000b80019b5b3d2
src/gromacs/hardware/detecthardware.cpp
src/gromacs/hardware/detecthardware.h
src/gromacs/hardware/hardwareassign.cpp
src/gromacs/hardware/hardwareassign.h
src/programs/mdrun/resource-division.cpp
src/programs/mdrun/runner.cpp
src/programs/mdrun/tests/moduletest.cpp