Automatic Differentiation
 
Loading...
Searching...
No Matches
stan::math::mpi_cluster Struct Reference

Detailed Description

MPI cluster holds MPI resources and must be initialized only once in any MPI program.

The RAII principle is used and MPI resource allocation and deallocation is done when constructing and destructing this object. This must occur only once in any program as the MPI layer will fail otherwise.

The available MPI resources are determined from environment variables which are usually set by the mpirun command which is recommended to launch any MPI program.

The mpirun program automatically starts the number of pre-specified processes. The boost mpi library is used to interface with MPI. In boost mpi terminology we refer to the overall MPI resources as world. Each process has an assigned rank which is a numeric index running from 0 to the number of processes-1 (also called the world size). We refer to the rank = 0 process as the root process and all others (rank > 0) are workers.

Definition at line 126 of file mpi_cluster.hpp.

#include <mpi_cluster.hpp>

Public Member Functions

 mpi_cluster ()
 
 ~mpi_cluster ()
 
void listen ()
 Switches cluster into listening mode.
 
void stop_listen ()
 Stops listening state of the cluster.
 

Static Public Member Functions

static bool & listening_status ()
 Returns the current listening state of the cluster.
 
static std::mutex & in_use ()
 Returns a reference to the global in use mutex.
 

Public Attributes

boost::mpi::environment env
 
boost::mpi::communicator world_
 
std::size_t const rank_ = world_.rank()
 

The documentation for this struct was generated from the following file: