MADNESS 0.10.1
safempi.h File Reference

Serializes calls to MPI in case it does not support THREAD_MULTIPLE. More...

#include <madness/madness_config.h>
#include <mpi.h>
#include <madness/world/worldmutex.h>
#include <madness/world/type_traits.h>
#include <atomic>
#include <iostream>
#include <limits>
#include <csignal>
#include <cstdlib>
#include <cstring>
#include <memory>
#include <sstream>
Include dependency graph for safempi.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  SafeMPI::ByteCount
 The (count, datatype) pair that describes a buffer of bytes to MPI. More...
class  SafeMPI::Exception
 SafeMPI exception object. More...
class  SafeMPI::Group
struct  SafeMPI::Group::Impl
struct  SafeMPI::Intracomm::Impl
class  SafeMPI::Intracomm
 Wrapper around MPI_Comm. Has a shallow copy constructor; use Create(Get_group()) for deep copy. More...
class  SafeMPI::Request
class  SafeMPI::Status

Namespaces

namespace  SafeMPI
namespace  SafeMPI::detail

Macros

#define MADNESS_MPI_TEST(condition)
#define MADNESS_SERIALIZES_MPI
#define SAFE_MPI_GLOBAL_MUTEX   madness::ScopedMutex<madness::SCALABLE_MUTEX_TYPE> obolus(SafeMPI::charon);

Functions

void SafeMPI::Attach_buffer (void *buffer, int size)
 Set buffer for Bsend .
int SafeMPI::Detach_buffer (void *&buffer)
 Unset the Bsend buffer.
int SafeMPI::Finalize ()
 Analogous to MPI_Finalize.
void SafeMPI::Init ()
 Analogous to MPI_Init.
void SafeMPI::Init (int &argc, char **&argv)
 Analogous to MPI_Init.
void SafeMPI::detail::init_comm_world ()
 Initialize SafeMPI::COMM_WORLD.
int SafeMPI::Init_thread (int &argc, char **&argv, int requested)
 Analogous to MPI_Init_thread.
int SafeMPI::Init_thread (int requested)
 Analogous to MPI_Init_thread.
bool SafeMPI::Is_finalized ()
 Check MPI finalization status.
bool SafeMPI::Is_initialized ()
 Check MPI initialization status.
MPI_Op SafeMPI::Op_create (MPI_User_function *user_fn, int commute)
 Analogous to MPI_Op_create.
void SafeMPI::Op_free (MPI_Op op)
 Analogous to MPI_Op_free.
void SafeMPI::detail::print_mpi_error (const int rc, const char *function, const int line, const char *file)
int SafeMPI::Query_thread ()
 Analogous to MPI_Query_thread.
double SafeMPI::Wtime ()
 Wall time.

Variables

static const int SafeMPI::DEFAULT_SEND_RECV_TAG = 1000
static const int SafeMPI::MPIAR_TAG = 1001
static const int SafeMPI::RMI_TAG = 1023

Detailed Description

Serializes calls to MPI in case it does not support THREAD_MULTIPLE.

Macro Definition Documentation

◆ MADNESS_MPI_TEST

#define MADNESS_MPI_TEST ( condition)
Value:
{ \
int mpi_error_code = condition; \
if(mpi_error_code != MPI_SUCCESS) { \
s[0] = '\0'; \
int len = 0; \
MPI_Error_string(mpi_error_code, s, &len); \
std::cout<< "MPI ERROR in " << __FUNCTION__ << " in " << __FILE__ << " at line " << __LINE__ << " code " << mpi_error_code << " err string " << s << "\n"; \
throw ::SafeMPI::Exception(mpi_error_code); \
} \
}
#define MPI_SUCCESS
Definition stubmpi.h:36
#define MPI_MAX_ERROR_STRING
Definition stubmpi.h:42

Referenced by SafeMPI::ByteCount::ByteCount(), SafeMPI::Group::Impl::Impl(), SafeMPI::Group::Impl::Impl(), SafeMPI::Intracomm::Intracomm(), SafeMPI::Intracomm::Allreduce(), SafeMPI::Attach_buffer(), SafeMPI::Intracomm::Barrier(), SafeMPI::Intracomm::Bcast(), SafeMPI::Intracomm::Create(), SafeMPI::Intracomm::Get_attr(), SafeMPI::Status::Get_byte_count(), SafeMPI::Status::Get_count(), SafeMPI::Init(), SafeMPI::detail::init_comm_world(), SafeMPI::Init_thread(), SafeMPI::Intracomm::Irecv(), SafeMPI::Intracomm::Irecv_bytes(), SafeMPI::Intracomm::Isend(), SafeMPI::Intracomm::Isend_bytes(), SafeMPI::Intracomm::Issend(), SafeMPI::Op_create(), SafeMPI::Op_free(), SafeMPI::Query_thread(), SafeMPI::Intracomm::Recv(), SafeMPI::Intracomm::Recv(), SafeMPI::Intracomm::Reduce(), SafeMPI::Intracomm::Send(), SafeMPI::Intracomm::Split(), SafeMPI::Intracomm::Split_type(), SafeMPI::Request::Test_got_lock_already(), SafeMPI::Request::Test_got_lock_already(), SafeMPI::Request::Testany(), SafeMPI::Request::Testany(), SafeMPI::Request::Testsome(), and SafeMPI::Group::Translate_ranks().

◆ MADNESS_SERIALIZES_MPI

#define MADNESS_SERIALIZES_MPI

Defined if MPI has the large-count functions introduced by MPI 4 ( MPI_Isend_c and the like), which take counts of type MPI_Count rather than int

◆ SAFE_MPI_GLOBAL_MUTEX