Environmental management#

MPL provides various functions for querying characteristics of the computational environment.

Current processor name#

inline std::string mpl::environment::processor_name()#

Gives a unique specifier, the processor name, for the actual (physical) node.

Note

The name is determined by the underlying MPI implementation, i.e., it is implementation defined and may be different for different MPI implementations.

Returns:

name of the node

Predefined communicators#

inline const communicator &mpl::environment::comm_world()#

Provides access to a predefined communicator that allows communication with all processes.

Returns:

communicator to communicate with any other process

inline const communicator &mpl::environment::comm_self()#

Provides access to a predefined communicator that includes only the calling process itself.

Returns:

communicator including only the precess itself

Threading support#

inline bool mpl::environment::is_thread_main()#

Determines if the current thread is the main thread, i.e., the thread that has initialized the MPI environment of the underlying MPI implementation.

Returns:

true if current thread is the main thread

inline threading_modes mpl::environment::threading_mode()#

Determines the highest level of thread support that is provided by the underlying MPI implementation.

Returns:

supported threading level

enum class mpl::threading_modes#

Represents the various levels of thread support that the underlying MPI implementation may provide.

Values:

enumerator single#

the application is single-threaded

enumerator funneled#

the application is multi-threaded, however all MPL calls will be issued from the main thread only

enumerator serialized#

the application is multi-threaded and any thread may issue MPL calls, however different threads will never issue MPL calls at the same time

enumerator multiple#

the application is multi-threaded, any thread may issue MPI calls and different threads may issue MPL calls at the same time

Time#

inline bool mpl::environment::wtime_is_global()#

Determines if time values given by wtime are synchronized with each other for all processes of the communicator given in comm_world.

See also

wtime

Returns:

true if times are synchronized

inline double mpl::environment::wtime()#

Get time.

Returns:

number of seconds of elapsed wall-clock time since some time in the past

inline double mpl::environment::wtick()#

Get resolution of time given by wtime.

See also

wtime

Returns:

resolution of wtime in seconds.

Management of buffers for buffered send operations#

inline void mpl::environment::buffer_attach(void *buff, int size)#

Provides to MPL a buffer in the user’s memory to be used for buffering outgoing messages.

See also

buffer_detach

Parameters:
  • buff – pointer to user-provided buffer

  • size – size of the buffer in bytes, must be non-negative

inline std::pair<void*, int> mpl::environment::buffer_detach()#

Detach the buffer currently associated with MPL.

See also

buffer_attach

Returns:

pair representing the buffer location and size, i.e., the parameters provided to buffer_attach

class bsend_buffer#

Buffer manager for buffered send operations.

Note

There must be not more than one instance of the class bsend_buffer at any time per process.

Public Functions

bsend_buffer() = delete#

deleted default constructor

bsend_buffer(const bsend_buffer &other) = delete#

deleted copy constructor

Parameters:

other – buffer manager to copy from

bsend_buffer(bsend_buffer &&other) = delete#

deleted move constructor

Parameters:

other – buffer manager to move from

inline explicit bsend_buffer(int size)#

allocates buffer with specific size using a default-constructed allocator

See also

communicator::bsend and communicator::ibsend

Note

The size given should be the sum of the sizes of all outstanding buffered send operations that will be sent during the lifetime of the bsend_buffer object, plus bsend_overhead for each buffered send operation. Use communicator::bsend_size to calculate the required buffer size.

Parameters:

size – buffer size in bytes

inline ~bsend_buffer()#

waits for uncompleted message transfers and frees the buffer

Note

A blocking communication operation is performed when an object of type bsend_buffer goes out of scope.

void operator=(const bsend_buffer &other) = delete#

deleted copy assignment operator

Parameters:

other – buffer manager to copy-assign from

void operator=(bsend_buffer &&other) = delete#

deleted move assignment operator

Parameters:

other – buffer manager to move-assign from