DIY  3.0
data-parallel out-of-core C++ library
 All Classes Namespaces Functions Typedefs Groups Pages
Classes | Functions
MPI

Detailed Description

DIY includes a simple C++ wrapper around the MPI commands. It borrows heavily from Boost.MPI design.

#include <diy/mpi.hpp>
int main(int argc, char* argv[])
{
diy::mpi::environment env(argc, argv); // RAII
...
}

A simple wrapper diy::mpi::environment takes care of MPI initialization and finalization using RAII. diy::mpi::communicator wraps an MPI_Comm object and provides methods to send() and recv() (as well as isend()) and irecv()).

All functions map C++ types to the appropriate MPI datatypes, with a specialized interface for an std::vector of them.

Collectives

Operations

class MPI operation
diy::mpi::maximum<U> MPI_MAX
diy::mpi::minimum<U> MPI_MIN
std::plus<U> MPI_SUM
std::multiplies<U> MPI_PROD
std::logical_and<U> MPI_LAND
std::logical_or<U> MPI_LOR

Classes

class  diy::mpi::communicator
 Simple wrapper around MPI_Comm. More...
 
class  diy::mpi::io::file
 Wraps MPI file IO. More...
 
struct  diy::mpi::maximum< U >
 
struct  diy::mpi::minimum< U >
 
struct  diy::mpi::environment
 

Functions

template<class T >
void diy::mpi::broadcast (const communicator &comm, T &x, int root)
 Broadcast to all processes in comm.
 
template<class T >
void diy::mpi::broadcast (const communicator &comm, std::vector< T > &x, int root)
 Broadcast for vectors.
 
template<class T >
request diy::mpi::ibroadcast (const communicator &comm, T &x, int root)
 iBroadcast to all processes in comm.
 
template<class T >
void diy::mpi::gather (const communicator &comm, const T &in, std::vector< T > &out, int root)
 Gather from all processes in comm. On root process, out is resized to comm.size() and filled with elements from the respective ranks.
 
template<class T >
void diy::mpi::gather (const communicator &comm, const std::vector< T > &in, std::vector< std::vector< T > > &out, int root)
 Same as above, but for vectors.
 
template<class T >
void diy::mpi::gather (const communicator &comm, const T &in, int root)
 Simplified version (without out) for use on non-root processes.
 
template<class T >
void diy::mpi::gather (const communicator &comm, const std::vector< T > &in, int root)
 Simplified version (without out) for use on non-root processes.
 
template<class T >
void diy::mpi::all_gather (const communicator &comm, const T &in, std::vector< T > &out)
 all_gather from all processes in comm. out is resized to comm.size() and filled with elements from the respective ranks.
 
template<class T >
void diy::mpi::all_gather (const communicator &comm, const std::vector< T > &in, std::vector< std::vector< T > > &out)
 Same as above, but for vectors.
 
template<class T , class Op >
void diy::mpi::reduce (const communicator &comm, const T &in, T &out, int root, const Op &op)
 reduce
 
template<class T , class Op >
void diy::mpi::reduce (const communicator &comm, const T &in, int root, const Op &op)
 Simplified version (without out) for use on non-root processes.
 
template<class T , class Op >
void diy::mpi::all_reduce (const communicator &comm, const T &in, T &out, const Op &op)
 all_reduce
 
template<class T , class Op >
void diy::mpi::all_reduce (const communicator &comm, const std::vector< T > &in, std::vector< T > &out, const Op &op)
 Same as above, but for vectors.
 
template<class T , class Op >
void diy::mpi::scan (const communicator &comm, const T &in, T &out, const Op &op)
 scan
 
template<class T >
void diy::mpi::all_to_all (const communicator &comm, const std::vector< T > &in, std::vector< T > &out, int n=1)
 all_to_all