Note: this is documentation for an old release. View the latest documentation at docs.fenicsproject.org/v0.1.0/v0.9.0/cpp
DOLFINx  0.1.0
DOLFINx C++ interface
Classes | Static Public Member Functions | List of all members
dolfinx::MPI Class Reference

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

#include <MPI.h>

Classes

class  Comm
 A duplicate MPI communicator and manage lifetime of the communicator. More...
 
struct  dependent_false
 

Static Public Member Functions

static int rank (MPI_Comm comm)
 Return process rank for the communicator.
 
static int size (MPI_Comm comm)
 Return size of the group (number of processes) associated with the communicator.
 
template<typename T >
static graph::AdjacencyList< T > all_to_all (MPI_Comm comm, const graph::AdjacencyList< T > &send_data)
 Send in_values[p0] to process p0 and receive values from process p1 in out_values[p1].
 
static std::vector< int > compute_graph_edges (MPI_Comm comm, const std::set< int > &edges)
 
template<typename T >
static graph::AdjacencyList< T > neighbor_all_to_all (MPI_Comm neighbor_comm, const graph::AdjacencyList< T > &send_data)
 Neighborhood all-to-all. Send data to neighbors. Send in_values[n0] to neighbor process n0 and receive values from neighbor process n1 in out_values[n1].
 
static std::tuple< std::vector< int >, std::vector< int > > neighbors (MPI_Comm neighbor_comm)
 
static std::size_t global_offset (MPI_Comm comm, std::size_t range, bool exclusive)
 Find global offset (index) (wrapper for MPI_(Ex)Scan with MPI_SUM as reduction op)
 
static std::array< std::int64_t, 2 > local_range (int process, std::int64_t N, int size)
 Return local range for given process, splitting [0, N - 1] into size() portions of almost equal size.
 
static int index_owner (int size, std::size_t index, std::size_t N)
 Return which process owns index (inverse of local_range) More...
 
template<typename T >
static MPI_Datatype mpi_type ()
 MPI Type.
 

Detailed Description

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

Member Function Documentation

◆ compute_graph_edges()

std::vector< int > dolfinx::MPI::compute_graph_edges ( MPI_Comm  comm,
const std::set< int > &  edges 
)
static
Todo:
Experimental. Maybe be moved or removed.

Compute communication graph edges. The caller provides edges that it can define, and will receive edges to it that are defined by other ranks.

Note
This function involves global communication
Parameters
[in]commThe MPI communicator
[in]edgesCommunication edges between the caller and the ranks in edges.
Returns
Ranks that have defined edges from them to this rank

◆ index_owner()

int dolfinx::MPI::index_owner ( int  size,
std::size_t  index,
std::size_t  N 
)
static

Return which process owns index (inverse of local_range)

Parameters
[in]sizeNumber of MPI ranks
[in]indexThe index to determine owning rank
[in]NTotal number of indices
Returns
The rank of the owning process

◆ neighbors()

std::tuple< std::vector< int >, std::vector< int > > dolfinx::MPI::neighbors ( MPI_Comm  neighbor_comm)
static
Todo:
Clarify directions

Return list of neighbors for a neighborhood communicator

Parameters
[in]neighbor_commNeighborhood communicator
Returns
source ranks, destination ranks

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