MADNESS  0.10.1
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Attributes | Friends | List of all members
madness::detail::WorldMpi Class Reference

MPI singleton that manages MPI setup and teardown for MADNESS. More...

#include <worldmpi.h>

Public Member Functions

 ~WorldMpi ()
 WorldMpi destructor. More...
 

Static Public Member Functions

static void finalize ()
 Finalize the MPI runtime. More...
 
static void initialize (int &argc, char **&argv, int requested)
 Initialize the MPI runtime. More...
 

Private Member Functions

 WorldMpi (const WorldMpi &)=delete
 
 WorldMpi (int &argc, char **&argv, int requested)
 WorldMpi constructor. More...
 
WorldMpioperator= (const WorldMpi &)=delete
 

Static Private Attributes

static bool own_mpi = false
 Flag storing if MADNESS is responsible for MPI. More...
 
static std::shared_ptr< WorldMpiworld_mpi
 Pointer to help MADNESS manage MPI. More...
 

Friends

class WorldMpiRuntime
 

Detailed Description

MPI singleton that manages MPI setup and teardown for MADNESS.

MADNESS will call WorldMpi::initialize and WorldMpi::finalize to setup and teardown the MPI runtime.

Constructor & Destructor Documentation

◆ WorldMpi() [1/2]

madness::detail::WorldMpi::WorldMpi ( int &  argc,
char **&  argv,
int  requested 
)
inlineprivate

WorldMpi constructor.

Initialize the MPI runtime for MADNESS.

Note
This constructor is private to prevent incorrect initialization. The user should call initialize.
Parameters
[in,out]argcThe number of command-line arguments to process.
[in,out]argvThe command-line arguments.
requestedThe requested thread support for MPI runtime

References SafeMPI::Attach_buffer(), SafeMPI::detail::init_comm_world(), SafeMPI::Init_thread(), and own_mpi.

Referenced by initialize().

◆ WorldMpi() [2/2]

madness::detail::WorldMpi::WorldMpi ( const WorldMpi )
privatedelete

◆ ~WorldMpi()

madness::detail::WorldMpi::~WorldMpi ( )
inline

Member Function Documentation

◆ finalize()

static void madness::detail::WorldMpi::finalize ( )
inlinestatic

Finalize the MPI runtime.

This function starts the teardown process of the MPI runtime. The actual MPI_Finalize will only be called when all the objects using MPI have been destroyed.

References world_mpi.

◆ initialize()

static void madness::detail::WorldMpi::initialize ( int &  argc,
char **&  argv,
int  requested 
)
inlinestatic

Initialize the MPI runtime.

This function starts the MPI runtime. If MPI is already running, then MADNESS delegate responsibility for MPI to the user. In either case, MPI thread support is checked to make sure MPI will play nice with MADNESS.

Exceptions
madness::ExceptionWhen MADNESS has already been initialized.
madness::ExceptionWhen MPI has already been finalized.
SafeMPI::ExceptionWhen an MPI error occurs.
Parameters
[in,out]argcThe number of command line arguments.
[in,out]argvThe values of command line arguments.
[in]requestedThe requested thread support for MPI runtime.

References WorldMpi(), SafeMPI::COMM_WORLD, SafeMPI::Intracomm::Get_rank(), SafeMPI::Is_finalized(), SafeMPI::Is_initialized(), MADNESS_ASSERT, MPI_Abort(), MPI_COMM_WORLD, MPI_THREAD_STRING, own_mpi, SafeMPI::Query_thread(), and world_mpi.

◆ operator=()

WorldMpi& madness::detail::WorldMpi::operator= ( const WorldMpi )
privatedelete

Friends And Related Function Documentation

◆ WorldMpiRuntime

friend class WorldMpiRuntime
friend

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