Auxiliary functions and classes#

Integer types#

using mpl::size_t = std::size_t#

Unsigned integer type used for array indexing and address arithmetic.

using mpl::ssize_t = std::ptrdiff_t#

Signed integer type used for array indexing and address arithmetic.

Ranks#

class ranks : private std::vector<int>#

Represents a collection of ranks.

See also

class group

Public Functions

inline explicit ranks(size_type n = 0)#

Constructs collection of ranks with all ranks having value zero.

Parameters:

n – initial size of the collection

inline ranks(std::initializer_list<int> init)#

Constructs collection of ranks from a braces expression of integers.

Parameters:

init – list of initial values

ranks(const ranks &other) = default#

Constructs collection of ranks from another collection.

Parameters:

other – the other collection to copy from

inline ranks(ranks &&other) noexcept#

Move-constructs collection of ranks from another collection.

Parameters:

other – the other collection to move from

inline const int *operator()() const#

Gives access to internal data.

Returns:

pointer to constant array

inline int *operator()()#

Gives access to internal data.

Returns:

pointer to array

Types for probing messages#

The following types are used in the context of probing messages. See section Probing messages for an example.

using mpl::message_t = MPI_Message#

Status of a received message.

class status_t : private MPI_Status#

Class that represents the status of a received message.

Public Functions

inline int source() const#
Returns:

source of the message

inline mpl::tag_t tag() const#
Returns:

tag value of the message

inline int error() const#
Returns:

error code associated with the message

inline bool is_cancelled() const#
Returns:

true if associated request has been been canceled

inline bool is_canceled() const#
Returns:

true if associated request has been been canceled

template<typename T>
inline int get_count() const#
Template Parameters:

T – received data type

Returns:

number of top level elements of type T received in associated message

template<typename T>
inline int get_count(const layout<T> &l) const#
Template Parameters:

T – received data type

Parameters:

l – layout used in associated message

Returns:

number of top level elements of type T received in associated message

inline status_t()#

default constructor initializes source and tag with wildcards given by any_source and tag_t::any and no error

Friends

friend class impl::base_communicator
friend class impl::base_request
friend class impl::request_pool
friend class file
struct mprobe_status#

Return value of matching probe operations.

Public Members

message_t message#

message handle to be used in a matching receive operation

status_t status#

status of the pending incoming message

Memory displacements#

The mpl::displacements class is used in the context of various collective communication operations that send and/or receive an amount of data that varies over the set of participating processes.

class displacements : private std::vector<MPI_Aint>#

Indicates the beginning of data buffers in various collective communication operations.

Public Types

using size_type = base::size_type#
using value_type = base::value_type#

Public Functions

inline explicit displacements(size_type n = 0)#

Constructs a set of displacements with displacement zero.

Parameters:

n – number of displacements

inline explicit displacements(std::initializer_list<MPI_Aint> init)#

Constructs a set of displacements with given displacements.

Parameters:

init – initial displacements

displacements(const displacements &other) = default#

Copy constructor.

Parameters:

other – the other set of displacements to copy from

displacements(displacements &&other) = default#

Move constructor.

Parameters:

other – the other set of displacements to move from

inline const MPI_Aint *operator()() const#

Get raw displacement data.

Returns:

pointer to array of displacements

Requests#

Test status enum#

enum class mpl::test_result#

Indicates kind of outcome of test for request completion.

Values:

enumerator completed#

some request has been completed

enumerator no_completed#

no request has been completed

enumerator no_active_requests#

there is no request waiting for completion

Non-blocking communication requests#

class irequest : public base_request<impl::base_irequest>#

Represents a non-blocking communication request.

Public Functions

irequest(const irequest&) = delete#

Deleted copy constructor.

inline irequest(irequest &&other) noexcept#

Move constructor.

Parameters:

other – the request to move from

void operator=(const irequest&) = delete#

Deleted copy operator.

inline irequest &operator=(irequest &&other) noexcept#

Move operator.

Parameters:

other – the request to move from

Returns:

reference to the moved-to request

inline void cancel()#

Cancels the request if it is pending.

inline std::optional<status_t> test()#

Tests for the completion.

Returns:

the operation’s status if completed successfully

inline status_t wait()#

Wait for a pending communication operation.

Returns:

operation’s status after completion

inline std::optional<status_t> get_status()#

Access information associated with a request without freeing the request.

Returns:

the operation’s status if completed successfully

Friends

friend class impl::request_pool< irequest >
class irequest_pool : public request_pool<irequest>#

Container for managing a list of non-blocking communication requests.

Public Types

using size_type = std::vector<MPI_Request>::size_type#

Type used in all index-based operations.

Public Functions

irequest_pool() = default#

Constructs an empty pool of communication requests.

irequest_pool(const irequest_pool&) = delete#

Deleted copy constructor.

inline irequest_pool(irequest_pool &&other) noexcept#

Move constructor.

Parameters:

other – the request pool to move from

void operator=(const irequest_pool&) = delete#

Deleted copy operator.

inline irequest_pool &operator=(irequest_pool &&other) noexcept#

Move operator.

Parameters:

other – the request pool to move from

Returns:

reference to the moved-to request pool

inline size_type size() const#

Determine the size of request pool.

Returns:

number of requests currently in request pool

inline bool empty() const#

Determine if request pool is empty.

Returns:

true if number of requests currently in request pool is non-zero

inline const status_t &get_status(size_type i) const#

Get status of a request.

Parameters:

i – index of the request for which the status will be returned

Returns:

status of request

inline void cancel(size_type i)#

Cancels a pending request in the pool.

Parameters:

i – index of the request for which shall be cancelled

inline void cancelall()#

Cancels all requests in the pool.

inline void push(irequest &&request)#

Move a request into the request pool.

Parameters:

request – request to move into the pool

inline std::pair<test_result, size_type> waitany()#

Wait for completion of any pending communication operation.

Returns:

pair containing the outcome of the wait operation and an index to the completed request if there was any pending request

inline std::pair<test_result, size_type> testany()#

Test for completion of any pending communication operation.

Returns:

pair containing the outcome of the test and an index to the completed request if there was any pending request

inline void waitall()#

Waits for completion of all pending requests.

inline bool testall()#

Tests for completion of all pending requests.

Returns:

true if all pending requests have completed

inline std::pair<test_result, std::vector<size_type>> waitsome()#

Waits until one or more pending requests have finished.

Returns:

pair containing the outcome of the wait operation and a list of indices to the completed requests if there was any pending request

inline std::pair<test_result, std::vector<size_type>> testsome()#

Tests if one or more pending requests have finished.

Returns:

pair containing the outcome of the test and a list of indices to the completed requests if there was any pending request

Persistent communication requests#

class prequest : public base_request<impl::base_prequest>#

Represents a persistent communication request.

Public Functions

prequest(const prequest&) = delete#

Deleted copy constructor.

inline prequest(prequest &&other) noexcept#

Move constructor.

Parameters:

other – the request to move from

void operator=(const prequest&) = delete#

Deleted copy operator.

inline prequest &operator=(prequest &&other) noexcept#

Move operator.

Parameters:

other – the request to move from

Returns:

reference to the moved-to request

inline void start()#

Start communication operation.

inline void cancel()#

Cancels the request if it is pending.

inline std::optional<status_t> test()#

Tests for the completion.

Returns:

the operation’s status if completed successfully

inline status_t wait()#

Wait for a pending communication operation.

Returns:

operation’s status after completion

inline std::optional<status_t> get_status()#

Access information associated with a request without freeing the request.

Returns:

the operation’s status if completed successfully

Friends

friend class impl::request_pool< prequest >
class prequest_pool : public request_pool<prequest>#

Container for managing a list of persisting communication requests.

Public Types

using size_type = std::vector<MPI_Request>::size_type#

Type used in all index-based operations.

Public Functions

prequest_pool() = default#

Constructs an empty pool of persistent communication requests.

prequest_pool(const prequest_pool&) = delete#

Deleted copy constructor.

inline prequest_pool(prequest_pool &&other) noexcept#

Move constructor.

Parameters:

other – the request pool to move from

void operator=(const prequest_pool&) = delete#

Deleted copy constructor.

inline prequest_pool &operator=(prequest_pool &&other) noexcept#

Move operator.

Parameters:

other – the request pool to move from

inline void startall()#

Start all persistent requests in the pool.

inline size_type size() const#

Determine the size of request pool.

Returns:

number of requests currently in request pool

inline bool empty() const#

Determine if request pool is empty.

Returns:

true if number of requests currently in request pool is non-zero

inline const status_t &get_status(size_type i) const#

Get status of a request.

Parameters:

i – index of the request for which the status will be returned

Returns:

status of request

inline void cancel(size_type i)#

Cancels a pending request in the pool.

Parameters:

i – index of the request for which shall be cancelled

inline void cancelall()#

Cancels all requests in the pool.

inline void push(prequest &&request)#

Move a request into the request pool.

Parameters:

request – request to move into the pool

inline std::pair<test_result, size_type> waitany()#

Wait for completion of any pending communication operation.

Returns:

pair containing the outcome of the wait operation and an index to the completed request if there was any pending request

inline std::pair<test_result, size_type> testany()#

Test for completion of any pending communication operation.

Returns:

pair containing the outcome of the test and an index to the completed request if there was any pending request

inline void waitall()#

Waits for completion of all pending requests.

inline bool testall()#

Tests for completion of all pending requests.

Returns:

true if all pending requests have completed

inline std::pair<test_result, std::vector<size_type>> waitsome()#

Waits until one or more pending requests have finished.

Returns:

pair containing the outcome of the wait operation and a list of indices to the completed requests if there was any pending request

inline std::pair<test_result, std::vector<size_type>> testsome()#

Tests if one or more pending requests have finished.

Returns:

pair containing the outcome of the test and a list of indices to the completed requests if there was any pending request

Command-line arguments#

class command_line : private std::vector<std::string>#

Represents a set of command-line arguments.

See also

class communicator::spawn

Public Functions

inline explicit command_line()#

Constructs an empty set of command-line arguments.

inline command_line(std::initializer_list<std::string> init)#

Constructs set of command-line arguments from a braces expression of strings.

Parameters:

init – list of initial values

command_line(const command_line &other) = default#

Constructs set of command-line arguments from another set.

Parameters:

other – the other set to copy from

inline command_line(command_line &&other) noexcept#

Move-constructs set of command-line arguments from another set.

Parameters:

other – the other set to move from

class command_lines : private std::vector<command_line>#

Represents a list of command-line argument sets.

See also

class communicator::spawn_multiple

Public Functions

inline explicit command_lines()#

Constructs an empty list of command-line argument sets.

inline command_lines(std::initializer_list<command_line> init)#

Constructs list of command-line argument sets from a braces expression of strings.

Parameters:

init – list of initial values

command_lines(const command_lines &other) = default#

Constructs list of command-line argument sets from another list.

Parameters:

other – the other list to copy from

inline command_lines(command_lines &&other) noexcept#

Move-constructs list of command-line argument sets from another list.

Parameters:

other – the other list to move from