Gromacs
2020.1
|
#include <gromacs/mdrun/simulationcontext.h>
Simulation environment and configuration.
SimulationContext allows a simulation module () to retrieve runtime parameters and resources from client code. The client retains ownership of the context and its resources, with exceptions as noted.
A client must share ownership of some resources and transfer ownership of other resources to create or configure the context. The simulation may in turn consume or borrow some resources from the context. This is a new framework that will evolve in the contexts of https://redmine.gromacs.org/issues/2375 https://redmine.gromacs.org/issues/2587
The public interface of SimulationContext is not yet well-specified. Client code can create an instance with gmx::createSimulationContext()
Public Member Functions | |
SimulationContext ()=delete | |
Object must be initialized with non-default constructor. | |
SimulationContext (MPI_Comm communicator, ArrayRef< const std::string > multiSimDirectoryNames) | |
Construct. More... | |
Public Attributes | |
MPI_Comm | communicator_ = MPI_COMM_NULL |
MPI communicator object for this simulation object. More... | |
std::unique_ptr< gmx_multisim_t > | multiSimulation_ |
Multi-sim handler (if required by e.g. gmx mdrun -multidir; only supported with real MPI) | |
|
explicit |
Construct.
communicator | MPI communicator for this (set of) simulations |
multiSimDirectoryNames | Names of any directories used with -multidir |
MPI_Comm gmx::SimulationContext::communicator_ = MPI_COMM_NULL |
MPI communicator object for this simulation object.
With real MPI, the gmx wrapper binary has called MPI_Init, thus MPI_COMM_WORLD is now valid to use, and (in future) the gmxapi runner will handle such details (e.g. via mpi4py) before creating its SimulationContext. In both cases, if a multi-simulation is in use, then its communicator(s) are found in multiSimulation_. This communicator is that of all ranks from all simulations, and will later be split into one for each simulation. TODO Perhaps (for simplicity) that communicator splitting task can be undertaken during multi-sim setup.
With thread-MPI in both cases, the communicator is set up later during the process of spawning the threads that will be the MPI ranks. (Multi-simulation is not supported with thread-MPI.)