Initialize, finalize, and query the MPI environment. More...
#include <environment.hpp>


Public Member Functions | |
| environment (int &argc, char **&argv, bool abort_on_exception=true) | |
| Initialize the MPI environment.  More... | |
| environment (int &argc, char **&argv, threading::level mt_level, bool abort_on_exception=true) | |
| Initialize the MPI environment.  More... | |
| ~environment () | |
| Shuts down the MPI environment.  More... | |
Static Public Member Functions | |
| static void | abort (int errcode) | 
| Abort all MPI processes.  More... | |
| static bool | initialized () | 
| Determine if the MPI environment has already been initialized.  More... | |
| static bool | finalized () | 
| Determine if the MPI environment has already been finalized.  More... | |
| static int | max_tag () | 
| Retrieves the maximum tag value.  More... | |
| static int | collectives_tag () | 
| The tag value used for collective operations.  More... | |
| static optional< int > | host_rank () | 
| Retrieves the rank of the host process, if one exists.  More... | |
| static optional< int > | io_rank () | 
| Retrieves the rank of a process that can perform input/output.  More... | |
| static std::string | processor_name () | 
| Retrieve the name of this processor.  More... | |
| static threading::level | thread_level () | 
| Query the current level of thread support.  More... | |
| static bool | is_main_thread () | 
| Are we in the main thread?  More... | |
Initialize, finalize, and query the MPI environment.
The environment class is used to initialize, finalize, and query the MPI environment. It will typically be used in the main() function of a program, which will create a single instance of environment initialized with the arguments passed to the program:
The instance of environment will initialize MPI (by calling MPI_Init) in its constructor and finalize MPI (by calling MPI_Finalize for normal termination or MPI_Abort for an uncaught exception) in its destructor.
The use of environment is not mandatory. Users may choose to invoke MPI_Init and MPI_Finalize manually. In this case, no environment object is needed. If one is created, however, it will do nothing on either construction or destruction. 
| boost::mpi::environment::environment | ( | int & | argc, | 
| char **& | argv, | ||
| bool | abort_on_exception = true  | 
        ||
| ) | 
Initialize the MPI environment.
If the MPI environment has not already been initialized, initializes MPI with a call to MPI_Init.
| argc | The number of arguments provided in argv, as passed into the program's main function. | 
| argv | The array of argument strings passed to the program via main. | 
| abort_on_exception | When true, this object will abort the program if it is destructed due to an uncaught exception. | 
| boost::mpi::environment::environment | ( | int & | argc, | 
| char **& | argv, | ||
| threading::level | mt_level, | ||
| bool | abort_on_exception = true  | 
        ||
| ) | 
Initialize the MPI environment.
If the MPI environment has not already been initialized, initializes MPI with a call to MPI_Init_thread.
| argc | The number of arguments provided in argv, as passed into the program's main function. | 
| argv | The array of argument strings passed to the program via main. | 
| mt_level | the required level of threading support | 
| abort_on_exception | When true, this object will abort the program if it is destructed due to an uncaught exception. | 
| boost::mpi::environment::~environment | ( | ) | 
Shuts down the MPI environment.
If this environment object was used to initialize the MPI environment, and the MPI environment has not already been shut down (finalized), this destructor will shut down the MPI environment. Under normal circumstances, this only involves invoking MPI_Finalize. However, if destruction is the result of an uncaught exception and the abort_on_exception parameter of the constructor had the value true, this destructor will invoke MPI_Abort with MPI_COMM_WORLD to abort the entire MPI program with a result code of -1. 
      
  | 
  static | 
Abort all MPI processes.
Aborts all MPI processes and returns to the environment. The precise behavior will be defined by the underlying MPI implementation. This is equivalent to a call to MPI_Abort with MPI_COMM_WORLD.
| errcode | The error code to return to the environment. | 
      
  | 
  static | 
The tag value used for collective operations.
Returns the reserved tag value used by the Boost.MPI implementation for collective operations. Although users are not permitted to use this tag to send or receive messages, it may be useful when monitoring communication patterns.
Referenced by boost::mpi::detail::gather_impl(), boost::mpi::detail::scatter_impl(), boost::mpi::detail::tree_reduce_impl(), and boost::mpi::detail::upper_lower_scan().
      
  | 
  static | 
Determine if the MPI environment has already been finalized.
The routine is equivalent to a call to MPI_Finalized.
true if the MPI environment has been finalized. 
      
  | 
  static | 
Retrieves the rank of the host process, if one exists.
If there is a host process, this routine returns the rank of that process. Otherwise, it returns an empty optional<int>. MPI does not define the meaning of a "host" process: consult the documentation for the MPI implementation. This routine examines the MPI_HOST attribute of MPI_COMM_WORLD.
      
  | 
  static | 
Determine if the MPI environment has already been initialized.
This routine is equivalent to a call to MPI_Initialized.
true if the MPI environment has been initialized. 
      
  | 
  static | 
Retrieves the rank of a process that can perform input/output.
This routine returns the rank of a process that can perform input/output via the standard C and C++ I/O facilities. If every process can perform I/O using the standard facilities, this routine will return any_source; if no process can perform I/O, this routine will return no value (an empty optional). This routine examines the MPI_IO attribute of MPI_COMM_WORLD.
any_source if every process can perform I/O, or no value if no process can perform I/O. 
      
  | 
  static | 
Are we in the main thread?
      
  | 
  static | 
Retrieves the maximum tag value.
Returns the maximum value that may be used for the tag parameter of send/receive operations. This value will be somewhat smaller than the value of MPI_TAG_UB, because the Boost.MPI implementation reserves some tags for collective operations.
      
  | 
  static | 
Retrieve the name of this processor.
This routine returns the name of this processor. The actual form of the name is unspecified, but may be documented by the underlying MPI implementation. This routine is implemented as a call to MPI_Get_processor_name.
      
  | 
  static | 
Query the current level of thread support.