MADNESS 0.10.1
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.

Static Public Member Functions

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

Private Member Functions

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

Static Private Attributes

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

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 WorldMpi(), initialize(), and operator=().

◆ WorldMpi() [2/2]

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

References WorldMpi().

◆ ~WorldMpi()

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

Member Function Documentation

◆ finalize()

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.

Referenced by madness::World::finalize.

◆ initialize()

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::Is_finalized(), SafeMPI::Is_initialized(), MADNESS_ASSERT, MPI_Abort(), MPI_COMM_WORLD, MPI_THREAD_STRING, own_mpi, SafeMPI::Query_thread(), and world_mpi.

Referenced by madness::World::initialize.

◆ operator=()

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

References WorldMpi().

◆ WorldMpiRuntime

friend class WorldMpiRuntime
friend

References WorldMpiRuntime.

Referenced by WorldMpiRuntime.


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