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() → 'MPI_Op'

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

static avg(comm: 'MPI_Comm', value: 'Table') → 'dolfin::Table'

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

static barrier(comm: 'MPI_Comm') → 'void'

Set a barrier (synchronization point)

static compute_local_range(process: 'int', N: 'std::int64_t', size: 'int') → 'std::pair< std::int64_t,std::int64_t >'

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

static gather(comm: 'MPI_Comm', in_values: 'std::string const &', out_values: 'std::vector< std::string > &', receiving_process: 'unsigned int'=0) → 'void'

Overloaded versions

  • gather(comm, in_values, out_values, receiving_process=0)

    Gather values on one process

  • gather(comm, in_values, out_values, receiving_process=0)

    Gather strings on one process

static global_offset(comm: 'MPI_Comm', range: 'std::size_t', exclusive: 'bool') → 'std::size_t'

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

static index_owner(comm: 'MPI_Comm', index: 'std::size_t', N: 'std::size_t') → 'unsigned int'

Return which process owns index (inverse of local_range)

static is_broadcaster(comm: 'MPI_Comm') → 'bool'

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

static is_receiver(comm: 'MPI_Comm') → 'bool'

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

static local_range(*args) → 'std::pair< std::int64_t,std::int64_t >'

Overloaded versions

  • local_range(comm, N)

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

  • local_range(comm, process, N)

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

static max(*args) → 'dolfin::Table'

Return global max value

static min(*args) → 'dolfin::Table'

Return global min value

static rank(comm: 'MPI_Comm') → 'unsigned int'

Return process rank for the communicator

static size(comm: 'MPI_Comm') → 'unsigned int'

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

static sum(*args) → 'dolfin::Table'

Sum values and return sum

thisown

The membership flag