From: Szilárd Páll Date: Wed, 21 Apr 2021 17:48:04 +0000 (+0200) Subject: Eliminate duplicate CPU->GPU copy of x X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=6d002ec667c955c5137acdad74663bdbc1712f2f;p=alexxy%2Fgromacs.git Eliminate duplicate CPU->GPU copy of x x is copied to the GPU for buffer ops or PME as well as prior to GPU update on search steps which leads to a duplicate copying which is addressed in this change. Fixes #4033 Refs #3988 --- diff --git a/src/gromacs/mdrun/md.cpp b/src/gromacs/mdrun/md.cpp index dc6a0a25e1..200f46559c 100644 --- a/src/gromacs/mdrun/md.cpp +++ b/src/gromacs/mdrun/md.cpp @@ -1523,8 +1523,15 @@ void gmx::LegacySimulator::do_md() *md); // Copy data to the GPU after buffers might have being reinitialized + // coordinates have been copied already if PME or buffer ops has not needed it this step. stateGpu->copyVelocitiesToGpu(state->v, AtomLocality::Local); - stateGpu->copyCoordinatesToGpu(state->x, AtomLocality::Local); + const bool useGpuPmeOnThisRank = runScheduleWork->simulationWork.useGpuPme + && thisRankHasDuty(cr, DUTY_PME) + && runScheduleWork->stepWork.computeSlowForces; + if (!useGpuPmeOnThisRank && !runScheduleWork->stepWork.useGpuXBufferOps) + { + stateGpu->copyCoordinatesToGpu(state->x, AtomLocality::Local); + } } if (simulationWork.useGpuPme && !runScheduleWork->simulationWork.useGpuPmePpCommunication