Remove excessive H2D and D2H coordinates copies when update is offloaded
authorArtem Zhmurov <zhmurov@gmail.com>
Wed, 16 Oct 2019 14:33:31 +0000 (16:33 +0200)
committerArtem Zhmurov <zhmurov@gmail.com>
Fri, 18 Oct 2019 14:45:32 +0000 (16:45 +0200)
commita73c3ec2dd9dd64f0c728b7b1d90ac5bcfb246cc
tree853a762bcdad1c3bc21efe1e719704fbbcb81570
parente2f179906d6039ea932d6032e9bd56e7ca9454a0
Remove excessive H2D and D2H coordinates copies when update is offloaded

The H2D copies are only needed:
1. When update is not ofloaded.
2. At the search steps, after device buffers were reinitialized.

The D2H copies are only needed:
1. On the search steps, since the device buffers are reinitialized.
2. If there are CPU consumers, e.g. CPU bondeds.
3. When the energy is computed.
4. When coordinates are needed for output.

There are two special cases, when coordinates are needed on host,
that dealt with separately:
1. When the PME it tuned.
2. When center of mass motion is removed.

The locality of copied atoms when update is offloaded is changed
from All to Local in preparation for multi-GPU case. The blocking sync
on H2D copy event is moved from UpdateConstraints to
StatePropagatorDataGpu.

Change-Id: I971a6273b39fa7da07600312c085ce343b5d25ee
src/gromacs/mdlib/sim_util.cpp
src/gromacs/mdlib/update_constrain_cuda.h
src/gromacs/mdlib/update_constrain_cuda_impl.cpp
src/gromacs/mdlib/update_constrain_cuda_impl.cu
src/gromacs/mdlib/update_constrain_cuda_impl.h
src/gromacs/mdrun/md.cpp
src/gromacs/mdtypes/state_propagator_data_gpu.h
src/gromacs/mdtypes/state_propagator_data_gpu_impl.cpp
src/gromacs/mdtypes/state_propagator_data_gpu_impl.h
src/gromacs/mdtypes/state_propagator_data_gpu_impl_gpu.cpp