MPI

class dolfin.cpp.common.MPI

Bases: object

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

static MPI_AVG()
static all_gather()

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

Parameters:
  • comm (MPI_Comm) –
  • std::string & in_values (const) –
  • std::string > & out_values (std::vector<) –
Return type:

void

static avg()

Return average across comm; implemented only for T == Table .

Parameters:
  • comm (MPI_Comm) –
  • T & value (const) –
Return type:

T

static barrier()

Set a barrier (synchronization point)

Parameters:comm (MPI_Comm) –
Return type:void
static compute_local_range()

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

Parameters:
  • process (int) –
  • N (std::int64_t) –
  • size (int) –
Return type:

std::pair< std::int64_t, std::int64_t >

static gather()

Gather strings on one process.

Parameters:
  • comm (MPI_Comm) –
  • std::string & in_values (const) –
  • std::string > & out_values (std::vector<) –
  • int receiving_process (unsigned) –
Return type:

void

static global_offset()

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

Parameters:
  • comm (MPI_Comm) –
  • range (std::size_t) –
  • exclusive (bool) –
Return type:

std::size_t

static index_owner()

Return which process owns index (inverse of local_range)

Parameters:
  • comm (MPI_Comm) –
  • index (std::size_t) –
  • N (std::size_t) –
Return type:

unsigned int

static is_broadcaster(comm: dolfin.cpp.common.MPI_Comm) → bool

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

Parameters:comm (MPI_Comm) –
Return type:bool
static is_receiver(comm: dolfin.cpp.common.MPI_Comm) → bool

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

Parameters:comm (MPI_Comm) –
Return type:bool
static local_range()

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

Parameters:
  • comm (MPI_Comm) –
  • process (int) –
  • N (std::int64_t) –
Return type:

std::pair< std::int64_t, std::int64_t >

static max()

Return global max value.

Parameters:
  • comm (MPI_Comm) –
  • T & value (const) –
Return type:

T

static min()

Return global min value.

Parameters:
  • comm (MPI_Comm) –
  • T & value (const) –
Return type:

T

static rank()

Return process rank for the communicator.

Parameters:comm (MPI_Comm) –
Return type:unsigned int
static size()

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

Parameters:comm (MPI_Comm) –
Return type:unsigned int
static sum()

Sum values and return sum.

Parameters:
  • comm (MPI_Comm) –
  • T & value (const) –
Return type:

T

thisown

The membership flag