HavoqGT
havoqgt::mpi::mpi_communicator Class Reference

#include <mpi.hpp>

Public Member Functions

 mpi_communicator (int argc, char **argv)
 
 mpi_communicator (MPI_Comm comm)
 
 ~mpi_communicator ()
 

Private Member Functions

 mpi_communicator (const mpi_communicator &)
 Not Copyable. More...
 
void check_mpi (int ret)
 Checks MPI return codes. More...
 

Private Attributes

MPI_Comm m_comm
 
uint32_t m_size
 
uint32_t m_rank
 
bool init
 

Detailed Description

Definition at line 116 of file mpi.hpp.

Constructor & Destructor Documentation

havoqgt::mpi::mpi_communicator::mpi_communicator ( int  argc,
char **  argv 
)
inline

Definition at line 118 of file mpi.hpp.

119  : init(true) {
120  check_mpi( MPI_Init(&argc, &argv) );
121  m_comm = MPI_COMM_WORLD;
122  }
void check_mpi(int ret)
Checks MPI return codes.
Definition: mpi.hpp:138

Here is the call graph for this function:

havoqgt::mpi::mpi_communicator::mpi_communicator ( MPI_Comm  comm)
inline

Definition at line 123 of file mpi.hpp.

124  : m_comm(MPI_COMM_WORLD),
125  init(false) { }
havoqgt::mpi::mpi_communicator::~mpi_communicator ( )
inline

Definition at line 127 of file mpi.hpp.

127  {
128  if(init) {
129  check_mpi( MPI_Finalize() );
130  }
131  }
void check_mpi(int ret)
Checks MPI return codes.
Definition: mpi.hpp:138

Here is the call graph for this function:

havoqgt::mpi::mpi_communicator::mpi_communicator ( const mpi_communicator )
private

Not Copyable.

Member Function Documentation

void havoqgt::mpi::mpi_communicator::check_mpi ( int  ret)
inlineprivate

Checks MPI return codes.

Definition at line 138 of file mpi.hpp.

138  {
139  if(ret != MPI_SUCCESS) {
140  char estring[MPI_MAX_ERROR_STRING];
141  int len(0);
142  MPI_Error_string(ret, estring, &len);
143  if(m_rank==0) {
144  std::cerr << "MPI ERROR = " << estring << std::endl;
145  }
146  MPI_Abort(m_comm, -1);
147  }
148  }

Here is the caller graph for this function:

Member Data Documentation

bool havoqgt::mpi::mpi_communicator::init
private

Definition at line 153 of file mpi.hpp.

MPI_Comm havoqgt::mpi::mpi_communicator::m_comm
private

Definition at line 150 of file mpi.hpp.

uint32_t havoqgt::mpi::mpi_communicator::m_rank
private

Definition at line 152 of file mpi.hpp.

uint32_t havoqgt::mpi::mpi_communicator::m_size
private

Definition at line 151 of file mpi.hpp.


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