Move Profiling parameter out of simulatorbuilder.build()
authorM. Eric Irrgang <ericirrgang@gmail.com>
Thu, 23 Apr 2020 14:29:25 +0000 (17:29 +0300)
committerJoe Jordan <ejjordan12@gmail.com>
Fri, 26 Jun 2020 10:54:08 +0000 (10:54 +0000)
Refs #3567

src/gromacs/mdrun/runner.cpp
src/gromacs/mdrun/simulatorbuilder.cpp
src/gromacs/mdrun/simulatorbuilder.h

index e8c1d80eba81f222f02ca007136448b9c997df7d..36acc0d9ea5721727d909c3b17ff3bff9d1b2fa3 100644 (file)
@@ -1659,8 +1659,7 @@ int Mdrunner::mdrunner()
                 useModularSimulator, static_cast<int>(filenames.size()), filenames.data(), vsite.get(),
                 constr.get(), enforcedRotation ? enforcedRotation->getLegacyEnfrot() : nullptr,
                 deform.get(), mdModules_->outputProvider(), mdModules_->notifier(), inputrec,
-                imdSession.get(), pull_work, swap, &mtop,  mdAtoms.get(), &nrnb, wcycle, fr,
-                replExParams, walltime_accounting);
+                imdSession.get(), pull_work, swap, &mtop, mdAtoms.get(), fr, replExParams);
         simulator->run();
 
         if (fr->pmePpCommGpu)
index dcf38a0e3464bdd48679ab90c71e608011c31c5c..8aa55bff7b62ae39af715354cccdeb9effa4161d 100644 (file)
@@ -71,11 +71,8 @@ std::unique_ptr<ISimulator> SimulatorBuilder::build(bool                     use
                                                     t_swap*                  swap,
                                                     gmx_mtop_t*              top_global,
                                                     MDAtoms*                 mdAtoms,
-                                                    t_nrnb*                  nrnb,
-                                                    gmx_wallcycle*           wcycle,
                                                     t_forcerec*              fr,
-                                                    const ReplicaExchangeParameters& replExParams,
-                                                    gmx_walltime_accounting* walltime_accounting)
+                                                    const ReplicaExchangeParameters& replExParams)
 {
     // TODO: Reduce protocol complexity.
     //     Investigate individual paramters. Identify default-constructable parameters and clarify
@@ -142,13 +139,13 @@ std::unique_ptr<ISimulator> SimulatorBuilder::build(bool                     use
         // NOLINTNEXTLINE(modernize-make-unique): make_unique does not work with private constructor
         return std::unique_ptr<ModularSimulator>(new ModularSimulator(
                 simulatorEnv_->fplog_, simulatorEnv_->commRec_, simulatorEnv_->multisimCommRec_,
-                simulatorEnv_->logger_, nfile, fnm, simulatorEnv_->outputEnv_,
-                simulatorConfig_->mdrunOptions_, simulatorConfig_->startingBehavior_, vsite, constr,
-                enforcedRotation, deform, outputProvider, mdModulesNotifier, inputrec, imdSession,
-                pull_work, swap, top_global,  simulatorStateData_->globalState_p,
-                simulatorStateData_->observablesHistory_p, mdAtoms, nrnb, wcycle, fr,
-                simulatorStateData_->enerdata_p, simulatorStateData_->ekindata_p,
-                simulatorConfig_->runScheduleWork_, replExParams, membedHolder_->membed(), walltime_accounting,
+                simulatorEnv_->logger_, nfile, fnm, simulatorEnv_->outputEnv_, simulatorConfig_->mdrunOptions_,
+                simulatorConfig_->startingBehavior_, vsite, constr, enforcedRotation, deform,
+                outputProvider, mdModulesNotifier, inputrec, imdSession, pull_work, swap, top_global,
+                simulatorStateData_->globalState_p, simulatorStateData_->observablesHistory_p,
+                mdAtoms, profiling_->nrnb, profiling_->wallCycle, fr, simulatorStateData_->enerdata_p,
+                simulatorStateData_->ekindata_p, simulatorConfig_->runScheduleWork_, replExParams,
+                membedHolder_->membed(), profiling_->walltimeAccounting,
                 std::move(stopHandlerBuilder_), simulatorConfig_->mdrunOptions_.rerun));
     }
     // NOLINTNEXTLINE(modernize-make-unique): make_unique does not work with private constructor
@@ -158,9 +155,10 @@ std::unique_ptr<ISimulator> SimulatorBuilder::build(bool                     use
             simulatorConfig_->startingBehavior_, vsite, constr, enforcedRotation, deform,
             outputProvider, mdModulesNotifier, inputrec, imdSession, pull_work, swap, top_global,
             simulatorStateData_->globalState_p, simulatorStateData_->observablesHistory_p, mdAtoms,
-            nrnb, wcycle, fr, simulatorStateData_->enerdata_p, simulatorStateData_->ekindata_p,
-            simulatorConfig_->runScheduleWork_, replExParams, membedHolder_->membed(), walltime_accounting,
-            std::move(stopHandlerBuilder_), simulatorConfig_->mdrunOptions_.rerun));
+            profiling_->nrnb, profiling_->wallCycle, fr, simulatorStateData_->enerdata_p,
+            simulatorStateData_->ekindata_p, simulatorConfig_->runScheduleWork_, replExParams,
+            membedHolder_->membed(), profiling_->walltimeAccounting, std::move(stopHandlerBuilder_),
+            simulatorConfig_->mdrunOptions_.rerun));
 }
 
 void SimulatorBuilder::add(MembedHolder&& membedHolder)
index c5014999e5ce60ba8a35b7df4184971f1143f5b1..2dd0f41746615557bfeee8f4938dda1631d7ca38 100644 (file)
@@ -150,11 +150,16 @@ public:
 class Profiling
 {
 public:
-    Profiling(t_nrnb gmx_unused*      nrnb,
-              gmx_walltime_accounting gmx_unused* pAccounting,
-              gmx_wallcycle gmx_unused* pWallcycle)
+    Profiling(t_nrnb* nrnb, gmx_walltime_accounting* walltimeAccounting, gmx_wallcycle* wallCycle) :
+        nrnb(nrnb),
+        wallCycle(wallCycle),
+        walltimeAccounting(walltimeAccounting)
     {
     }
+
+    t_nrnb*                  nrnb;
+    gmx_wallcycle*           wallCycle;
+    gmx_walltime_accounting* walltimeAccounting;
 };
 
 class ConstraintsParam
@@ -311,11 +316,8 @@ public:
                                       t_swap*                          swap,
                                       gmx_mtop_t*                      top_global,
                                       MDAtoms*                         mdAtoms,
-                                      t_nrnb*                          nrnb,
-                                      gmx_wallcycle*                   wcycle,
                                       t_forcerec*                      fr,
-                                      const ReplicaExchangeParameters& replExParams,
-                                      gmx_walltime_accounting*         walltime_accounting);
+                                      const ReplicaExchangeParameters& replExParams);
 
 private:
     // Note: we use std::unique_ptr instead of std::optional because we want to