newRunner.pforce = pforce;
// Give the spawned thread the newly created valid communicator
// for the simulation.
+ newRunner.worldCommunicator = MPI_COMM_WORLD;
newRunner.communicator = MPI_COMM_WORLD;
newRunner.ms = ms;
newRunner.startingBehavior = startingBehavior;
// Give the master thread the newly created valid communicator for
// the simulation.
- communicator = MPI_COMM_WORLD;
+ worldCommunicator = MPI_COMM_WORLD;
+ communicator = MPI_COMM_WORLD;
threadMpiMdrunnerAccessBarrier();
#else
GMX_UNUSED_VALUE(numThreadsToLaunch);
// this is expressed, e.g. by expressly running detection only the
// master rank for thread-MPI, rather than relying on the mutex
// and reference count.
- PhysicalNodeCommunicator physicalNodeComm(communicator, gmx_physicalnode_id_hash());
+ PhysicalNodeCommunicator physicalNodeComm(worldCommunicator, gmx_physicalnode_id_hash());
hwinfo = gmx_detect_hardware(mdlog, physicalNodeComm);
gmx_print_detected_hardware(fplog, isSimulationMasterRank && isMasterSim(ms), mdlog, hwinfo);
spawnThreads(hw_opt.nthreads_tmpi);
// The spawned threads enter mdrunner() and execution of
// master and spawned threads joins at the end of this block.
- physicalNodeComm = PhysicalNodeCommunicator(communicator, gmx_physicalnode_id_hash());
+ physicalNodeComm = PhysicalNodeCommunicator(worldCommunicator, gmx_physicalnode_id_hash());
}
GMX_RELEASE_ASSERT(ms || communicator == MPI_COMM_WORLD,
//! Command-line override for the duration of a neighbor list with the Verlet scheme.
int nstlist_ = 0;
+ //! World communicator, used for hardware detection and task assignment
+ MPI_Comm worldCommunicator_ = MPI_COMM_NULL;
+
//! Multisim communicator handle.
gmx_multisim_t* multiSimulation_;
compat::not_null<SimulationContext*> context) :
mdModules_(std::move(mdModules))
{
- communicator_ = context->communicator_;
- multiSimulation_ = context->multiSimulation_.get();
+ worldCommunicator_ = context->worldCommunicator_;
+ communicator_ = context->simulationCommunicator_;
+ multiSimulation_ = context->multiSimulation_.get();
}
Mdrunner::BuilderImplementation::~BuilderImplementation() = default;
newRunner.filenames = filenames_;
+ newRunner.worldCommunicator = worldCommunicator_;
+
newRunner.communicator = communicator_;
// nullptr is a valid value for the multisim handle