- // Copy coordinate from the GPU if update is on the GPU and there
- // are forces to be computed on the CPU, or for the computation of
- // virial, or if host-side data will be transferred from this task
- // to a remote task for halo exchange or PME-PP communication. At
- // search steps the current coordinates are already on the host,
- // hence copy is not needed.
- const bool haveHostPmePpComms =
- !thisRankHasDuty(cr, DUTY_PME) && !simulationWork.useGpuPmePpCommunication;
-
- GMX_ASSERT(simulationWork.useGpuHaloExchange
- == ((cr->dd != nullptr) && (!cr->dd->gpuHaloExchange[0].empty())),
- "The GPU halo exchange is active, but it has not been constructed.");
- const bool haveHostHaloExchangeComms =
- havePPDomainDecomposition(cr) && !simulationWork.useGpuHaloExchange;
-
- bool gmx_used_in_debug haveCopiedXFromGpu = false;
- if (simulationWork.useGpuUpdate && !stepWork.doNeighborSearch
- && (runScheduleWork->domainWork.haveCpuLocalForceWork || stepWork.computeVirial
- || haveHostPmePpComms || haveHostHaloExchangeComms))
- {
- GMX_ASSERT(stateGpu != nullptr, "stateGpu should not be null");
- stateGpu->copyCoordinatesFromGpu(x.unpaddedArrayRef(), AtomLocality::Local);
- haveCopiedXFromGpu = true;
- }
-