Class Environment¶
Defined in File mpi_env.hpp
Class Documentation¶
-
class
qhipster::mpi
::
Environment
¶ A trimmed down version of the BOOST::MPI environment. Its purpose is to initialize the MPI library and partition the cluster or single threaded environment for parallel operations. In preparation of the Monte-Carlo simulations required for the noisy implementation, we provide a communicator over the ranks involved in a single MC simulation.
Specifically, we store two communicators:
pool_communicator: spanning all the useful ranks
state_communicator: spanning those ranks used in a single MC simulation (i.e. state)
Public Functions
-
Environment
(int &argc, char **&argv)¶ Intialize the MPI Environment.
It receives the same argc and argv arguments passed to the main function. If MPI is present, but has not been initialized, then MPI_Init will be called.
-
~Environment
()¶ Finalize the MPI Environment
If MPI is present and has been initizlized in the constructor then MPI_Finalize will be called here.
-
Environment
(Environment const&) = delete¶
-
Environment &
operator=
(Environment const&) = delete¶
Public Static Functions
-
void
UpdateStateComm
(int num_states, bool do_print_info = true)¶ Update the state and pool communicators.
- Pre
This can only be called when all ranks are still active.
-
bool
IsUsefulRank
()¶ Check whether the rank is useful or not.
-
int
GetPoolRank
()¶ The rank of the current MPI process: pool or state.
The PoolRank may not corresponds to that from MPI_COMM_WORLD due to dummy ranks. The rank is 0 if MPI is not present.
- Pre
If MPI is present, this can only be called after intializing MPI.
-
int
GetStateRank
()¶
-
int
GetRank
()¶
-
int
GetPoolSize
()¶ Number of MPI processes.
The PoolSize may not corresponds to that from MPI_COMM_WORLD due to dummy ranks. The number of processes is 1 if MPI is not present.
- Pre
If MPI is present, this can only be called after intializing MPI.
-
int
GetStateSize
()¶
-
int
GetSize
()¶
-
template<class
Type
>
TypeIncoherentSumOverAllStatesOfPool
(Type local_value)¶ Get incoherent average over all states of the pool.
- Parameters
local_value
: the address of the value stored in the local rank.
-
int
GetNumRanksPerNode
()¶
-
int
GetNumNodes
()¶
-
int
GetNodeId
()¶
-
int
GetStateId
()¶
-
int
GetNumStates
()¶
-
void
RemapStateRank
(int newme)¶