Fix "wait before marking" synchronization bug
authorAndrey Alekseenko <al42and@gmail.com>
Fri, 5 Mar 2021 15:37:51 +0000 (18:37 +0300)
committerAndrey Alekseenko <al42and@gmail.com>
Mon, 8 Mar 2021 08:53:38 +0000 (08:53 +0000)
We did not initiate a D2H copy of coordinates when doing a neighbor
search but were anyway waiting on the associated event.

Unlikely that it had any negative consequences, but that's still a logic
bug.

src/gromacs/mdlib/sim_util.cpp

index f679912904bb39bb347ec09e02ee43f9f4e32744..b9e9bbc4a25075e1d6596062af42f9d4fdd7840c 100644 (file)
@@ -1677,9 +1677,10 @@ void do_force(FILE*                               fplog,
 
     // For the rest of the CPU tasks that depend on GPU-update produced coordinates,
     // this wait ensures that the D2H transfer is complete.
-    if ((simulationWork.useGpuUpdate)
+    if (simulationWork.useGpuUpdate && !stepWork.doNeighborSearch
         && (runScheduleWork->domainWork.haveCpuLocalForceWork || stepWork.computeVirial))
     {
+        GMX_ASSERT(haveCopiedXFromGpu, "a wait should only be triggered if copy has been scheduled");
         stateGpu->waitCoordinatesReadyOnHost(AtomLocality::Local);
     }