Celeritas 0.7.0-dev.242+develop.62c3034b
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
celeritas::ScopedMpiInit Class Reference

RAII class for initializing and finalizing MPI. More...

#include <ScopedMpiInit.hh>

Public Types

enum class  Status { disabled = -1 , uninitialized = 0 , initialized = 1 }
 Status of initialization. More...
 

Public Member Functions

 ScopedMpiInit (int *argc, char ***argv)
 Construct with argc/argv references.
 
 ScopedMpiInit ()
 Construct with null argc/argv when those are unavailable.
 
 ~ScopedMpiInit ()
 Call MPI finalize on destruction.
 
bool is_world_multiprocess () const
 Convenience method to determine whether a multiprocess job is running.
 
 ScopedMpiInit (ScopedMpiInit const &)=delete
 
ScopedMpiInitoperator= (ScopedMpiInit const &)=delete
 
 ScopedMpiInit (ScopedMpiInit &&)=delete
 
ScopedMpiInitoperator= (ScopedMpiInit &&)=delete
 

Static Public Member Functions

static Status status ()
 Whether MPI has been initialized or disabled.
 

Detailed Description

RAII class for initializing and finalizing MPI.

The CELER_DISABLE_PARALLEL environment variable can be used to turn off MPI calls when built with CELERITAS_USE_MPI .

Todo:
Change to CELER_ENABLE_MPI .
Note
Unlike the MpiCommunicator and MpiOperations class, it is not necessary to link against MPI to use this class.

Member Enumeration Documentation

◆ Status

Status of initialization.

Enumerator
disabled 

Not compiled or disabled via environment.

uninitialized 

MPI_Init has not been called anywhere.

initialized 

MPI_Init has been called somewhere.

Constructor & Destructor Documentation

◆ ScopedMpiInit() [1/3]

celeritas::ScopedMpiInit::ScopedMpiInit ( int argc,
char ***  argv 
)

Construct with argc/argv references.

OpenMPI does not modify or access these, but other implementations might potentially.

◆ ScopedMpiInit() [2/3]

celeritas::ScopedMpiInit::ScopedMpiInit ( ScopedMpiInit const )
delete

Prevent copying and moving for RAII class

◆ ScopedMpiInit() [3/3]

celeritas::ScopedMpiInit::ScopedMpiInit ( ScopedMpiInit &&  )
delete

Prevent copying and moving for RAII class

Member Function Documentation

◆ is_world_multiprocess()

bool celeritas::ScopedMpiInit::is_world_multiprocess ( ) const

Convenience method to determine whether a multiprocess job is running.

This is a shortcut for comm_world().size() > 1 meant primarily for applications. Linking against MPI is not required to use it.

◆ operator=() [1/2]

ScopedMpiInit & celeritas::ScopedMpiInit::operator= ( ScopedMpiInit &&  )
delete

Prevent copying and moving for RAII class

◆ operator=() [2/2]

ScopedMpiInit & celeritas::ScopedMpiInit::operator= ( ScopedMpiInit const )
delete

Prevent copying and moving for RAII class

◆ status()

auto celeritas::ScopedMpiInit::status ( )
static

Whether MPI has been initialized or disabled.

NOTE: This function cannot call the CELER_LOG macros because those macros query the status.


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