DOLFIN
DOLFIN C++ interface
Classes | Public Member Functions | Static Public Member Functions | List of all members
dolfin::MPI Class Reference

#include <MPI.h>

Classes

class  Comm
 

Public Member Functions

template<>
dolfin::Table all_reduce (const MPI_Comm comm, const dolfin::Table &table, const MPI_Op op)
 
template<>
dolfin::Table avg (MPI_Comm comm, const dolfin::Table &table)
 
template<>
void all_to_all (MPI_Comm comm, std::vector< std::vector< bool >> &in_values, std::vector< std::vector< bool >> &out_values)
 
template<>
void all_to_all (MPI_Comm comm, std::vector< std::vector< bool >> &in_values, std::vector< bool > &out_values)
 
template<>
void scatter (MPI_Comm comm, const std::vector< std::vector< bool >> &in_values, std::vector< bool > &out_value, unsigned int sending_process)
 
template<>
Table all_reduce (MPI_Comm, const Table &, MPI_Op)
 
template<>
Table avg (MPI_Comm, const Table &)
 

Static Public Member Functions

static unsigned int rank (MPI_Comm comm)
 Return process rank for the communicator.
 
static unsigned int size (MPI_Comm comm)
 
static bool is_broadcaster (MPI_Comm comm)
 
static bool is_receiver (MPI_Comm comm)
 
static void barrier (MPI_Comm comm)
 Set a barrier (synchronization point)
 
template<typename T >
static void all_to_all (MPI_Comm comm, std::vector< std::vector< T >> &in_values, std::vector< std::vector< T >> &out_values)
 
template<typename T >
static void all_to_all (MPI_Comm comm, std::vector< std::vector< T >> &in_values, std::vector< T > &out_values)
 
template<typename T >
static void broadcast (MPI_Comm comm, std::vector< T > &value, unsigned int broadcaster=0)
 Broadcast vector of value from broadcaster to all processes.
 
template<typename T >
static void broadcast (MPI_Comm comm, T &value, unsigned int broadcaster=0)
 Broadcast single primitive from broadcaster to all processes.
 
template<typename T >
static void scatter (MPI_Comm comm, const std::vector< std::vector< T >> &in_values, std::vector< T > &out_value, unsigned int sending_process=0)
 Scatter vector in_values[i] to process i.
 
template<typename T >
static void scatter (MPI_Comm comm, const std::vector< T > &in_values, T &out_value, unsigned int sending_process=0)
 Scatter primitive in_values[i] to process i.
 
template<typename T >
static void gather (MPI_Comm comm, const std::vector< T > &in_values, std::vector< T > &out_values, unsigned int receiving_process=0)
 Gather values on one process.
 
static void gather (MPI_Comm comm, const std::string &in_values, std::vector< std::string > &out_values, unsigned int receiving_process=0)
 Gather strings on one process.
 
template<typename T >
static void all_gather (MPI_Comm comm, const std::vector< T > &in_values, std::vector< T > &out_values)
 
template<typename T >
static void all_gather (MPI_Comm comm, const std::vector< T > &in_values, std::vector< std::vector< T >> &out_values)
 Gather values from each process (variable count per process)
 
template<typename T >
static void all_gather (MPI_Comm comm, const T in_value, std::vector< T > &out_values)
 Gather values, one primitive from each process (MPI_Allgather)
 
static void all_gather (MPI_Comm comm, const std::string &in_values, std::vector< std::string > &out_values)
 
template<typename T >
static T max (MPI_Comm comm, const T &value)
 Return global max value.
 
template<typename T >
static T min (MPI_Comm comm, const T &value)
 Return global min value.
 
template<typename T >
static T sum (MPI_Comm comm, const T &value)
 Sum values and return sum.
 
template<typename T >
static T avg (MPI_Comm comm, const T &value)
 Return average across comm; implemented only for T == Table.
 
template<typename T , typename X >
static T all_reduce (MPI_Comm comm, const T &value, X op)
 All reduce.
 
static std::size_t global_offset (MPI_Comm comm, std::size_t range, bool exclusive)
 
template<typename T >
static void send_recv (MPI_Comm comm, const std::vector< T > &send_value, unsigned int dest, int send_tag, std::vector< T > &recv_value, unsigned int source, int recv_tag)
 Send-receive data between processes (blocking)
 
template<typename T >
static void send_recv (MPI_Comm comm, const std::vector< T > &send_value, unsigned int dest, std::vector< T > &recv_value, unsigned int source)
 Send-receive data between processes.
 
static std::pair< std::int64_t, std::int64_t > local_range (MPI_Comm comm, std::int64_t N)
 
static std::pair< std::int64_t, std::int64_t > local_range (MPI_Comm comm, int process, std::int64_t N)
 
static std::pair< std::int64_t, std::int64_t > compute_local_range (int process, std::int64_t N, int size)
 
static unsigned int index_owner (MPI_Comm comm, std::size_t index, std::size_t N)
 Return which process owns index (inverse of local_range)
 
static MPI_Op MPI_AVG ()
 

Detailed Description

This class provides utility functions for easy communication with MPI and handles cases when DOLFIN is not configured with MPI.

Member Function Documentation

template<typename T >
void dolfin::MPI::all_gather ( MPI_Comm  comm,
const std::vector< T > &  in_values,
std::vector< T > &  out_values 
)
static

Gather values from all processes. Same data count from each process (wrapper for MPI_Allgather)

void dolfin::MPI::all_gather ( MPI_Comm  comm,
const std::string &  in_values,
std::vector< std::string > &  out_values 
)
inlinestatic

Gather values, one primitive from each process (MPI_Allgather). Specialization for std::string

template<typename T >
void dolfin::MPI::all_to_all ( MPI_Comm  comm,
std::vector< std::vector< T >> &  in_values,
std::vector< std::vector< T >> &  out_values 
)
static

Send in_values[p0] to process p0 and receive values from process p1 in out_values[p1]

template<typename T >
void dolfin::MPI::all_to_all ( MPI_Comm  comm,
std::vector< std::vector< T >> &  in_values,
std::vector< T > &  out_values 
)
static

Send in_values[p0] to process p0 and receive values from all processes in out_values

std::pair< std::int64_t, std::int64_t > dolfin::MPI::compute_local_range ( int  process,
std::int64_t  N,
int  size 
)
static

Return local range for given process, splitting [0, N - 1] into size() portions of almost equal size

std::size_t dolfin::MPI::global_offset ( MPI_Comm  comm,
std::size_t  range,
bool  exclusive 
)
static

Find global offset (index) (wrapper for MPI_(Ex)Scan with MPI_SUM as reduction op)

bool dolfin::MPI::is_broadcaster ( MPI_Comm  comm)
static

Determine whether we should broadcast (based on current parallel policy)

bool dolfin::MPI::is_receiver ( MPI_Comm  comm)
static

Determine whether we should receive (based on current parallel policy)

std::pair< std::int64_t, std::int64_t > dolfin::MPI::local_range ( MPI_Comm  comm,
std::int64_t  N 
)
static

Return local range for local process, splitting [0, N - 1] into size() portions of almost equal size

std::pair< std::int64_t, std::int64_t > dolfin::MPI::local_range ( MPI_Comm  comm,
int  process,
std::int64_t  N 
)
static

Return local range for given process, splitting [0, N - 1] into size() portions of almost equal size

MPI_Op dolfin::MPI::MPI_AVG ( )
static

Return average reduction operation; recognized by all_reduce(MPI_Comm, Table&, MPI_Op)

unsigned int dolfin::MPI::size ( MPI_Comm  comm)
static

Return size of the group (number of processes) associated with the communicator


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