Gromacs  2020.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Public Attributes
gmx::SimulationContext Class Referencefinal

#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

The public interface of SimulationContext is not yet well-specified. Client code can create an instance with gmx::createSimulationContext()

This class should also handle aspects of simulation environment such as working directory and environment variables.

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_tmultiSimulation_
 Multi-sim handler (if required by e.g. gmx mdrun -multidir; only supported with real MPI)

Constructor & Destructor Documentation

gmx::SimulationContext::SimulationContext ( MPI_Comm  communicator,
ArrayRef< const std::string >  multiSimDirectoryNames 


communicatorMPI communicator for this (set of) simulations
multiSimDirectoryNamesNames of any directories used with -multidir

Member Data Documentation

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.)

The documentation for this class was generated from the following files: