Loading...
Searching...
No Matches
Dune::MPIHelper Class Reference
Common » Parallel Communication

A real mpi helper. More...

`#include <dune/common/parallel/mpihelper.hh>`

## Public Types

typedef MPI_Comm | MPICommunicator
| The type of the mpi communicator.

## Public Member Functions

int | rank () const
| return rank of process
int | size () const
| return number of processes
| ~MPIHelper ()
| calls MPI_Finalize

## Static Public Member Functions

static MPICommunicator | getCommunicator ()
| get the default communicator
static MPICommunicator | getLocalCommunicator ()
| get a local communicator
static Communication< MPICommunicator > | getCommunication ()
static DUNE_EXPORT MPIHelper & | instance (int &argc, char **&argv)
| Get the singleton instance of the helper.

## Static Public Attributes

static constexpr bool | isFake = false
| Are we fake (i. e. pretend to have MPI support but are compiled without.

## Related Symbols

(Note that these are not member symbols.)
static DUNE_EXPORT MPIHelper & | instance (int *argc=nullptr, char ***argv=nullptr)
| Get the singleton instance of the helper.

## Detailed Description

A real mpi helper.

This helper should be used for parallel programs.

## Member Typedef Documentation

## MPICommunicator

typedef MPI_Comm Dune::MPIHelper::MPICommunicator

The type of the mpi communicator.

## Constructor & Destructor Documentation

## ~MPIHelper()

Dune::MPIHelper::~MPIHelper | ( |  | ) |

inline

calls MPI_Finalize

## Member Function Documentation

## getCommunication()

Communication< MPICommunicator > Dune::MPIHelper::getCommunication | ( |  | ) |

inline static

## getCommunicator()

MPICommunicator Dune::MPIHelper::getCommunicator | ( |  | ) |

inline static

get the default communicator

Return a communicator to exchange data with all processes

Returns
  MPI_COMM_WORLD

## getLocalCommunicator()

MPICommunicator Dune::MPIHelper::getLocalCommunicator | ( |  | ) |

inline static

get a local communicator

Returns a communicator to exchange data with the local process only

Returns
  MPI_COMM_SELF

## instance()

DUNE_EXPORT MPIHelper & Dune::MPIHelper::instance | ( | int & | argc,
|  | char **& | argv )

inline static

Get the singleton instance of the helper.

This method has to be called with the same arguments that the main method of the program was called:

int main(int argc, char** argv){
MPIHelper::instance(argc, argv);
// program code comes here
...
}
main
int main(int argc, char **argv)
Definition mpi_collective_benchmark.cc:297
Dune::MPIHelper::instance
static DUNE_EXPORT MPIHelper & instance(int &argc, char **&argv)
Get the singleton instance of the helper.
Definition mpihelper.hh:228

The MPIHelper will be globally initialized on its first call. Afterwards, all arguments to this function will be ignored.

Parameters

  argc | The number of arguments provided to main.
  argv | The arguments provided to main.

## rank()

int Dune::MPIHelper::rank | ( |  | ) | const

inline

return rank of process

## size()

int Dune::MPIHelper::size | ( |  | ) | const

inline

return number of processes

## Friends And Related Symbol Documentation

## instance()

DUNE_EXPORT MPIHelper & instance | ( | int * | argc = nullptr,
|  | char *** | argv = nullptr )

related

Get the singleton instance of the helper.

This method can be called either without any arguments, or with the same arguments that the main method of the program was called, passed as pointer:

int main(int argc, char** argv){
MPIHelper::instance();
// or: MPIHelper::instance(&argc, &argv);
// program code comes here
...
}

The MPIHelper will be globally initialized on its first call. Afterwards, all arguments to this function will be ignored.

Note
  This overload accepts all arguments by pointer similar to the MPI_Init function and allows to pass nullptr for all arguments.

(int&, char**&)

Parameters

  argc | The number of arguments provided to main.
  argv | The arguments provided to main.

## Member Data Documentation

## isFake

bool Dune::MPIHelper::isFake = false

static constexpr

Are we fake (i. e. pretend to have MPI support but are compiled without.

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

- mpihelper.hh