Clarify data flow in GPU task assignment
authorMark Abraham <mark.j.abraham@gmail.com>
Fri, 4 Aug 2017 16:09:17 +0000 (18:09 +0200)
committerKasson <kasson@gmail.com>
Thu, 10 Aug 2017 14:49:48 +0000 (16:49 +0200)
commit99f65881311effd767574e073b9b65b96f954141
tree848a76a2b3254a572539b41123085250df319eff
parent80c3f0d8ec228c6266ab721cadcb3dca48aad1d1
Clarify data flow in GPU task assignment

Previously, hw_opt.gpu_opt->dev_use could be filled with data at two
widely separated points, which was harder to understand and maintain
than this alternative.

The possible user-supplied task assignment is now copied into the
vector for task assignment that is later used by mdrunner to configure
the modules that do the work. The automated assignment fills the same
data structure, but the semantics are improved by using a vector, and
copying the user assignment is now trivial.

userGpuTaskAssignment is now part of hw_opt like other user options,
and stored in a string. Eventually the ordinary-data type hw_opt will
be used in a const-like manner, so this changes helps with that.
gmx_hw_opt_t now cannot be allocated with snew, but there is no longer
any reason to consider doing so.

Together, these eliminate gmx_gpu_opt_t because it is now merely a
vector (for now).

The parsing of the string from mdrun -gpu_id is simplified now that
its result is stored in a vector (and tests added). This aspect is
likely to get more complicated when a user assignment might look
different, e.g. "01:2,3:45" if/when we have two ranks each doing a two
PP and one PME task on different GPUs. Moved the parsing code from
detecthardware.cpp to hardwareassign.cpp, where it makes a bit more
sense.

Related trivial cleanup in gmx tune_pme, that uses the same parsing
machinery for GPU IIs, so that it can manage suitably.

Removed getCompatibleGpus() from header file, since its usage is now
local to hardwareassign.cpp. Similary, anyGpuIdIsRepeated() is no
longer used.

Change-Id: I1071281d3348c9cce05e7ac39a24775611ccc0dd
21 files changed:
src/gromacs/gmxana/gmx_tune_pme.cpp
src/gromacs/hardware/detecthardware.cpp
src/gromacs/hardware/detecthardware.h
src/gromacs/hardware/gpu_hw_info.h
src/gromacs/hardware/hardwareassign.cpp
src/gromacs/hardware/hardwareassign.h
src/gromacs/hardware/hw_info.h
src/gromacs/hardware/printhardware.cpp
src/gromacs/hardware/printhardware.h
src/gromacs/mdrunutility/tests/threadaffinitytest.cpp
src/gromacs/mdrunutility/tests/threadaffinitytest.h
src/gromacs/utility/cstringutil.cpp
src/gromacs/utility/cstringutil.h
src/gromacs/utility/stringutil.cpp
src/gromacs/utility/stringutil.h
src/gromacs/utility/tests/stringutil.cpp
src/programs/mdrun/mdrun.cpp
src/programs/mdrun/resource-division.cpp
src/programs/mdrun/resource-division.h
src/programs/mdrun/runner.cpp
src/programs/mdrun/runner.h