- // 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. At search steps the current coordinates are
- // already on the host, hence copy is not needed.
+ // TODO Update this comment when introducing SimulationWorkload
+ //
+ // The conditions for gpuHaloExchange e.g. using GPU buffer
+ // operations were checked before construction, so here we can
+ // just use it and assert upon any conditions.
+ gmx::GpuHaloExchange* gpuHaloExchange =
+ (havePPDomainDecomposition(cr) ? cr->dd->gpuHaloExchange.get() : nullptr);
+ const bool ddUsesGpuDirectCommunication = (gpuHaloExchange != nullptr);
+ GMX_ASSERT(!ddUsesGpuDirectCommunication || (useGpuXBufOps == BufferOpsUseGpu::True),
+ "Must use coordinate buffer ops with GPU halo exchange");
+ const bool useGpuForcesHaloExchange =
+ ddUsesGpuDirectCommunication && (useGpuFBufOps == BufferOpsUseGpu::True);
+
+ // 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;
+ const bool haveHostHaloExchangeComms = havePPDomainDecomposition(cr) && !ddUsesGpuDirectCommunication;