Move PME GPU program building later
authorSzilárd Páll <pall.szilard@gmail.com>
Mon, 30 Sep 2019 10:54:52 +0000 (12:54 +0200)
committerArtem Zhmurov <zhmurov@gmail.com>
Mon, 30 Sep 2019 16:21:31 +0000 (18:21 +0200)
Moves the code closer to where it is needed and later during
initialization so even without a high-level manager, context between
nonbonded and PME could be be shared.

Change-Id: I47d9645dc0ee5574960964dfd3f79479ff21bcea

src/gromacs/mdrun/runner.cpp

index f0a678899ecc9be8e21e4c7b4e41999fefc75bbe..811127955e98eb78b0d34d4d296338196b9b1e05 100644 (file)
@@ -1174,17 +1174,6 @@ int Mdrunner::mdrunner()
     gmx_device_info_t *pmeDeviceInfo         = gpuTaskAssignments.initPmeDevice();
     const bool         thisRankHasPmeGpuTask = gpuTaskAssignments.thisRankHasPmeGpuTask();
 
-    // TODO should live in ewald module once its testing is improved
-    //
-    // Later, this program could contain kernels that might be later
-    // re-used as auto-tuning progresses, or subsequent simulations
-    // are invoked.
-    PmeGpuProgramStorage pmeGpuProgram;
-    if (thisRankHasPmeGpuTask)
-    {
-        pmeGpuProgram = buildPmeGpuProgram(pmeDeviceInfo);
-    }
-
     /* getting number of PP/PME threads on this MPI / tMPI rank.
        PME: env variable should be read only on one node to make sure it is
        identical everywhere;
@@ -1345,6 +1334,17 @@ int Mdrunner::mdrunner()
     GMX_ASSERT(thisRankHasDuty(cr, DUTY_PP) == (fr != nullptr), "Double-checking that only PME-only ranks have no forcerec");
     gmx_pme_t * &pmedata = fr ? fr->pmedata : sepPmeData;
 
+    // TODO should live in ewald module once its testing is improved
+    //
+    // Later, this program could contain kernels that might be later
+    // re-used as auto-tuning progresses, or subsequent simulations
+    // are invoked.
+    PmeGpuProgramStorage pmeGpuProgram;
+    if (thisRankHasPmeGpuTask)
+    {
+        pmeGpuProgram = buildPmeGpuProgram(pmeDeviceInfo);
+    }
+
     /* Initiate PME if necessary,
      * either on all nodes or on dedicated PME nodes only. */
     if (EEL_PME(inputrec->coulombtype) || EVDW_PME(inputrec->vdwtype))