Fix signal propagation (modular simulator)
authorPascal Merz <pascal.merz@me.com>
Tue, 22 Oct 2019 17:35:51 +0000 (11:35 -0600)
committerPascal Merz <pascal.merz@colorado.edu>
Tue, 22 Oct 2019 21:56:41 +0000 (23:56 +0200)
In the modular simulator, signals between ranks were not reduced by
compute globals. This disabled the processing of SIGINT and might
have influenced checkpointing.

Change-Id: Idebe3c80f796c41cfdb12922c26c4920ca8d9d20

src/gromacs/modularsimulator/computeglobalselement.cpp
src/gromacs/modularsimulator/computeglobalselement.h
src/gromacs/modularsimulator/modularsimulator.cpp

index a96ff9e7d3a8ccaf20a0ed6377de87a4c1edb3ca..9805acf2e92bc535c76430088199e601d2f14341 100644 (file)
@@ -63,6 +63,7 @@ ComputeGlobalsElement<algorithm>::ComputeGlobalsElement(
         StatePropagatorData           *statePropagatorData,
         EnergyElement                 *energyElement,
         FreeEnergyPerturbationElement *freeEnergyPerturbationElement,
+        SimulationSignals             *signals,
         int                            nstglobalcomm,
         FILE                          *fplog,
         const MDLogger                &mdlog,
@@ -91,7 +92,7 @@ ComputeGlobalsElement<algorithm>::ComputeGlobalsElement(
     localTopology_(nullptr),
     freeEnergyPerturbationElement_(freeEnergyPerturbationElement),
     vcm_(global_top->groups, *inputrec),
-    signals_(),
+    signals_(signals),
     fplog_(fplog),
     mdlog_(mdlog),
     cr_(cr),
@@ -225,7 +226,7 @@ void ComputeGlobalsElement<algorithm>::scheduleTask(
 
         // Make signaller to signal stop / reset / checkpointing signals
         auto signaller = std::make_shared<SimulationSignaller>(
-                    &signals_, cr_, nullptr, doInterSimSignal, doIntraSimSignal);
+                    signals_, cr_, nullptr, doInterSimSignal, doIntraSimSignal);
 
         (*registerRunFunction)(
                 std::make_unique<SimulatorRunFunction>(
@@ -280,7 +281,7 @@ void ComputeGlobalsElement<algorithm>::scheduleTask(
         const bool doInterSimSignal = false;
 
         auto       signaller = std::make_shared<SimulationSignaller>(
-                    &signals_, cr_, nullptr, doInterSimSignal, doIntraSimSignal);
+                    signals_, cr_, nullptr, doInterSimSignal, doIntraSimSignal);
 
         (*registerRunFunction)(
                 std::make_unique<SimulatorRunFunction>(
index 61e0be4b55c9174e825dbc7ee163d1c079dd4b0d..85ca27ebef3b28348d2cc52911e7f96e597e9e36 100644 (file)
@@ -109,6 +109,7 @@ class ComputeGlobalsElement final :
             StatePropagatorData           *statePropagatorData,
             EnergyElement                 *energyElement,
             FreeEnergyPerturbationElement *freeEnergyPerturbationElement,
+            SimulationSignals             *signals,
             int                            nstglobalcomm,
             FILE                          *fplog,
             const MDLogger                &mdlog,
@@ -221,9 +222,9 @@ class ComputeGlobalsElement final :
         FreeEnergyPerturbationElement *freeEnergyPerturbationElement_;
 
         //! Center of mass motion removal
-        t_vcm             vcm_;
+        t_vcm              vcm_;
         //! Signals
-        SimulationSignals signals_;
+        SimulationSignals *signals_;
 
         // Access to ISimulator data
         //! Handles logging.
index 7ab5d179b643885f87b149601ccb4547c9c58119..7bf1d8accf761f998e4e237ebd4f273d01f77a1b 100644 (file)
@@ -626,7 +626,7 @@ std::unique_ptr<ISimulatorElement> ModularSimulator::buildIntegrator(
         auto computeGlobalsElement =
             std::make_unique< ComputeGlobalsElement<ComputeGlobalsAlgorithm::LeapFrog> >(
                     statePropagatorDataPtr, energyElementPtr, freeEnergyPerturbationElementPtr,
-                    nstglobalcomm_, fplog, mdlog, cr,
+                    &signals_, nstglobalcomm_, fplog, mdlog, cr,
                     inputrec, mdAtoms, nrnb, wcycle, fr,
                     &topologyHolder_->globalTopology(), constr, hasReadEkinState);
         topologyHolder_->registerClient(computeGlobalsElement.get());
@@ -697,7 +697,7 @@ std::unique_ptr<ISimulatorElement> ModularSimulator::buildIntegrator(
         auto computeGlobalsElementAtFullTimeStep =
             std::make_unique< ComputeGlobalsElement<ComputeGlobalsAlgorithm::VelocityVerletAtFullTimeStep> >(
                     statePropagatorDataPtr, energyElementPtr, freeEnergyPerturbationElementPtr,
-                    nstglobalcomm_, fplog, mdlog, cr,
+                    &signals_, nstglobalcomm_, fplog, mdlog, cr,
                     inputrec, mdAtoms, nrnb, wcycle, fr,
                     &topologyHolder_->globalTopology(), constr, hasReadEkinState);
         topologyHolder_->registerClient(computeGlobalsElementAtFullTimeStep.get());
@@ -707,7 +707,7 @@ std::unique_ptr<ISimulatorElement> ModularSimulator::buildIntegrator(
         auto computeGlobalsElementAfterCoordinateUpdate =
             std::make_unique<ComputeGlobalsElement <ComputeGlobalsAlgorithm::VelocityVerletAfterCoordinateUpdate> >(
                     statePropagatorDataPtr, energyElementPtr, freeEnergyPerturbationElementPtr,
-                    nstglobalcomm_, fplog, mdlog, cr,
+                    &signals_, nstglobalcomm_, fplog, mdlog, cr,
                     inputrec, mdAtoms, nrnb, wcycle, fr,
                     &topologyHolder_->globalTopology(), constr, hasReadEkinState);
         topologyHolder_->registerClient(computeGlobalsElementAfterCoordinateUpdate.get());