KaMPIng 0.1.1
Flexible and (near) zero-overhead C++ bindings for MPI
Loading...
Searching...
No Matches
kamping::Communicator< DefaultContainerType, Plugins > Class Template Reference

Wrapper for MPI communicator providing access to rank() and size() of the communicator. The Communicator is also access point to all MPI communications provided by KaMPIng. More...

#include <communicator.hpp>

Inheritance diagram for kamping::Communicator< DefaultContainerType, Plugins >:
Collaboration diagram for kamping::Communicator< DefaultContainerType, Plugins >:

Public Types

template<typename... Args>
using default_container_type = DefaultContainerType<Args...>
 Type of the default container type to use for containers created inside operations of this communicator.
 

Public Member Functions

 Communicator ()
 Default constructor not specifying any MPI communicator and using MPI_COMM_WORLD by default.
 
 Communicator (MPI_Comm comm, bool take_ownership=false)
 Constructor where an MPI communicator has to be specified.
 
 Communicator (MPI_Comm comm, int root, bool take_ownership=false)
 Constructor where an MPI communicator and the default root have to be specified.
 
 Communicator (Communicator const &other)
 Copy constructor that duplicates the MPI_Comm and takes ownership of the newly created one in the copy.
 
 Communicator (Communicator &&other)
 Move constructor.
 
virtual ~Communicator ()
 Destructor that frees the contained MPI_Comm if it is owned by the Communicator.
 
Communicatoroperator= (Communicator &&other)
 Move assignment operator.
 
Communicatoroperator= (Communicator const &other)
 Copy assignment operator. Behaves according to the copy constructor.
 
void swap (Communicator &other)
 Swaps the Communicator with another Communicator.
 
void abort (int errorcode=1) const
 Terminates MPI execution environment (on all processes in this Communicator). Beware of MPI implementations who might terminate all processes, whether they are in this communicator or not.
 
int rank_signed () const
 Rank of the current MPI process in the communicator as int.
 
size_t rank () const
 Rank of the current MPI process in the communicator as size_t.
 
int size_signed () const
 Number of MPI processes in this communicator as int.
 
size_t size () const
 Number of MPI processes in this communicator as size_t.
 
size_t num_numa_nodes () const
 Number of NUMA nodes (different shared memory regions) in this communicator. This operation is expensive (communicator splitting and communication). You should cache the result if you need it multiple times.
 
std::string processor_name () const
 Get this 'processor's' name using MPI_Get_processor_name.
 
MPI_Comm mpi_communicator () const
 MPI communicator corresponding to this communicator.
 
MPI_Comm disown_mpi_communicator ()
 Disowns the wrapped MPI_Comm, i.e. it will not be freed in the destructor.
 
void default_tag (int const default_tag)
 Set a new default tag used in point to point communication. The initial value is 0.
 
int default_tag () const
 Default tag used in point to point communication. The initial value is 0.
 
void root (int const new_root)
 Set a new root for MPI operations that require a root.
 
void root (size_t const new_root)
 Set a new root for MPI operations that require a root.
 
size_t root () const
 Default root for MPI operations that require a root as size_t.
 
int root_signed () const
 Default root for MPI operations that require a root as int.
 
bool is_root (int const root) const
 Check if this rank is the root rank.
 
bool is_root (size_t const root) const
 Check if this rank is the root rank.
 
bool is_root () const
 Check if this rank is the root rank.
 
Communicator split (int const color, int const key=0) const
 Split the communicator in different colors.
 
Communicator split_by_type (int const type) const
 Split the communicator by the specified type (e.g., shared memory)
 
Communicator split_to_shared_memory () const
 Split the communicator into NUMA nodes.
 
Group group () const
 Return the group associated with this communicator.
 
template<typename Ranks >
Communicator create_subcommunicators (Ranks const &ranks_in_own_group) const
 Create subcommunicators.
 
Communicator create_subcommunicators (RankRanges const &rank_ranges) const
 Create (sub-)communicators using a sparse representation for the ranks contained in the subcommunicators.
 
CommunicatorComparisonResult compare (Communicator const &other_comm) const
 Compare this communicator with another given communicator. Uses MPI_Comm_compare internally.
 
int convert_rank_to_communicator (int const rank, Communicator const &other_comm) const
 Convert a rank from this communicator to the rank in another communicator.
 
int convert_rank_from_communicator (int const rank, Communicator const &other_comm) const
 Convert a rank from another communicator to the rank in this communicator.
 
size_t rank_shifted_checked (int const distance) const
 Computes a rank that is distance ranks away from this MPI thread's current rank and checks if this is valid rank in this communicator.
 
size_t rank_shifted_cyclic (int const distance) const
 Computes a rank that is some ranks apart from this MPI thread's rank modulo the communicator's size.
 
bool is_valid_rank (int const rank) const
 Checks if a rank is a valid rank for this communicator, i.e., if the rank is in [0, size).
 
bool is_valid_rank (size_t const rank) const
 Checks if a rank is a valid rank for this communicator, i.e., if the rank is in [0, size).
 
void mpi_error_hook (int const error_code, std::string const &callee) const
 If error_code != MPI_SUCCESS, searchs the plugins for a public mpi_error_handler(const int error_code, std::string& callee) member. Searches the plugins front to back and calls the first handler found. If no handler is found, calls the default error hook. If error code is MPI_SUCCESS, does nothing.
 
void mpi_error_default_handler (int const error_code, std::string const &function_name) const
 Default MPI error callback. Depending on KASSERT_EXCEPTION_MODE either throws a MpiErrorException if error_code != MPI_SUCCESS or fails an assertion.
 
template<typename... Args>
void send (Args... args) const
 
template<typename... Args>
void bsend (Args... args) const
 Convenience wrapper for MPI_Bsend. Calls kamping::Communicator::send() with the appropriate send mode set.
 
template<typename... Args>
void ssend (Args... args) const
 Convenience wrapper for MPI_Ssend. Calls kamping::Communicator::send() with the appropriate send mode set.
 
template<typename... Args>
void rsend (Args... args) const
 Convenience wrapper for MPI_Rsend. Calls kamping::Communicator::send() with the appropriate send mode set.
 
template<typename... Args>
auto isend (Args... args) const
 
template<typename... Args>
auto ibsend (Args... args) const
 Convenience wrapper for MPI_Ibsend. Calls kamping::Communicator::isend() with the appropriate send mode set.
 
template<typename... Args>
auto issend (Args... args) const
 Convenience wrapper for MPI_Issend. Calls kamping::Communicator::isend() with the appropriate send mode set.
 
template<typename... Args>
auto irsend (Args... args) const
 Convenience wrapper for MPI_Irsend. Calls kamping::Communicator::isend() with the appropriate send mode set.
 
template<typename... Args>
auto probe (Args... args) const
 
template<typename... Args>
auto iprobe (Args... args) const
 
template<typename recv_value_type_tparam = kamping::internal::unused_tparam, typename... Args>
auto recv (Args... args) const
 
template<typename recv_value_type_tparam , typename... Args>
auto recv_single (Args... args) const
 Convience wrapper for receiving single values via MPI_Recv.
 
template<typename recv_value_type_tparam = kamping::internal::unused_tparam, typename... Args>
auto try_recv (Args... args) const
 
template<typename recv_value_type_tparam = kamping::internal::unused_tparam, typename... Args>
auto irecv (Args... args) const
 
template<typename... Args>
auto alltoall (Args... args) const
 Wrapper for MPI_Alltoall.
 
template<typename... Args>
auto alltoall_inplace (Args... args) const
 Wrapper for the in-place version of Communicator::alltoall.
 
template<typename... Args>
auto alltoallv (Args... args) const
 Wrapper for MPI_Alltoallv.
 
template<typename recv_value_type_tparam = kamping::internal::unused_tparam, typename... Args>
auto scatter (Args... args) const
 
template<typename recv_value_type_tparam = kamping::internal::unused_tparam, typename... Args>
auto scatter_single (Args... args) const
 
template<typename recv_value_type_tparam = kamping::internal::unused_tparam, typename... Args>
auto scatterv (Args... args) const
 Wrapper for MPI_Scatterv.
 
template<typename... Args>
auto reduce (Args... args) const
 
template<typename... Args>
auto reduce_single (Args... args) const
 Wrapper for MPI_Reduce.
 
template<typename... Args>
auto scan (Args... args) const
 
template<typename... Args>
auto scan_inplace (Args... args) const
 Wrapper for the in-place version of Communicator::scan().
 
template<typename... Args>
auto scan_single (Args... args) const
 Wrapper for MPI_Scan for single elements.
 
template<typename... Args>
auto exscan (Args... args) const
 Wrapper for MPI_Exscan.
 
template<typename... Args>
auto exscan_inplace (Args... args) const
 Wrapper for the in-place version of Communicator::exscan().
 
template<typename... Args>
auto exscan_single (Args... args) const
 Wrapper for MPI_exscan for single elements.
 
template<typename... Args>
auto allreduce (Args... args) const
 Wrapper for MPI_Allreduce; which is semantically a reduction followed by a broadcast.
 
template<typename... Args>
auto allreduce_inplace (Args... args) const
 Wrapper for the in-place version of Communicator::allreduce().
 
template<typename... Args>
auto allreduce_single (Args... args) const
 Wrapper for MPI_Allreduce; which is semantically a reduction followed by a broadcast.
 
template<typename... Args>
auto iallreduce (Args... args) const
 Wrapper for MPI_Iallreduce.
 
template<typename... Args>
auto gather (Args... args) const
 Wrapper for MPI_Gather.
 
template<typename... Args>
auto gatherv (Args... args) const
 Wrapper for MPI_Gatherv.
 
template<typename... Args>
auto allgather (Args... args) const
 Wrapper for MPI_Allgather.
 
template<typename... Args>
auto allgather_inplace (Args... args) const
 Wrapper for the in-place version of MPI_Allgather.
 
template<typename... Args>
auto allgatherv (Args... args) const
 Wrapper for MPI_Allgatherv.
 
template<typename recv_value_type_tparam = kamping::internal::unused_tparam, typename... Args>
auto bcast (Args... args) const
 Wrapper for MPI_Bcast.
 
template<typename recv_value_type_tparam = kamping::internal::unused_tparam, typename... Args>
auto bcast_single (Args... args) const
 Wrapper for MPI_Bcast.
 
template<typename... Args>
void barrier (Args... args) const
 Perform a MPI_Barrier on this communicator.
 
template<typename... Args>
auto ibarrier (Args... args) const
 Perform a non-blocking barrier synchronization on this communicator using MPI_Ibarrier. The call is associated with a kamping::Request (either allocated by KaMPIng or provided by the user). Only when the request has completed, it is guaranteed that all ranks have reached the barrier.
 
template<typename Value >
bool is_same_on_all_ranks (Value const &value) const
 Checks if all ranks provide the same value to this collective.
 

Protected Attributes

size_t _rank
 Rank of the MPI process in this communicator.
 
size_t _size
 Number of MPI processes in this communicator.
 
MPI_Comm _comm
 Corresponding MPI communicator.
 
size_t _root
 Default root for MPI operations that require a root.
 
int _default_tag
 Default tag value used in point to point communication.
 
bool _owns_mpi_comm
 

Detailed Description

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
class kamping::Communicator< DefaultContainerType, Plugins >

Wrapper for MPI communicator providing access to rank() and size() of the communicator. The Communicator is also access point to all MPI communications provided by KaMPIng.

Template Parameters
DefaultContainerTypeThe default container type to use for containers created by KaMPIng. Defaults to std::vector.
PluginsPlugins adding functionality to KaMPIng. Plugins should be classes taking a Communicator template parameter and can assume that they are castable to Communicator from which they can call any function of kamping::Communicator. See test/plugin_tests.cpp for examples.

Member Typedef Documentation

◆ default_container_type

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
template<typename... Args>
using kamping::Communicator< DefaultContainerType, Plugins >::default_container_type = DefaultContainerType<Args...>

Type of the default container type to use for containers created inside operations of this communicator.

Template Parameters
ArgsArguments to the container type.

Constructor & Destructor Documentation

◆ Communicator() [1/4]

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
kamping::Communicator< DefaultContainerType, Plugins >::Communicator ( MPI_Comm comm,
bool take_ownership = false )
inlineexplicit

Constructor where an MPI communicator has to be specified.

Parameters
commMPI communicator that is wrapped by this Communicator.
take_ownershipWhether the Communicator should take ownership of comm, i.e. free it in the destructor.

◆ Communicator() [2/4]

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
kamping::Communicator< DefaultContainerType, Plugins >::Communicator ( MPI_Comm comm,
int root,
bool take_ownership = false )
inlineexplicit

Constructor where an MPI communicator and the default root have to be specified.

Parameters
commMPI communicator that is wrapped by this Communicator.
rootDefault root that is used by MPI operations requiring a root.
take_ownershipWhether the Communicator should take ownership of comm, i.e. free it in the destructor.

◆ Communicator() [3/4]

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
kamping::Communicator< DefaultContainerType, Plugins >::Communicator ( Communicator< DefaultContainerType, Plugins > const & other)
inline

Copy constructor that duplicates the MPI_Comm and takes ownership of the newly created one in the copy.

Parameters
otherThe Communicator to copy.

◆ Communicator() [4/4]

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
kamping::Communicator< DefaultContainerType, Plugins >::Communicator ( Communicator< DefaultContainerType, Plugins > && other)
inline

Move constructor.

Parameters
otherThe Communicator to move.

Member Function Documentation

◆ abort()

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
void kamping::Communicator< DefaultContainerType, Plugins >::abort ( int errorcode = 1) const
inline

Terminates MPI execution environment (on all processes in this Communicator). Beware of MPI implementations who might terminate all processes, whether they are in this communicator or not.

Parameters
errorcodeError code to return to invoking environment.

◆ compare()

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
CommunicatorComparisonResult kamping::Communicator< DefaultContainerType, Plugins >::compare ( Communicator< DefaultContainerType, Plugins > const & other_comm) const
inline

Compare this communicator with another given communicator. Uses MPI_Comm_compare internally.

Parameters
other_commCommunicator with which this communicator is compared.
Returns
Return whether compared communicators are identical, congruent, similar or unequal.

◆ convert_rank_from_communicator()

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
int kamping::Communicator< DefaultContainerType, Plugins >::convert_rank_from_communicator ( int const rank,
Communicator< DefaultContainerType, Plugins > const & other_comm ) const
inline

Convert a rank from another communicator to the rank in this communicator.

Parameters
rankThe rank in other_comm
other_commThe communicator to convert the rank from
Returns
The rank in this communicator

◆ convert_rank_to_communicator()

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
int kamping::Communicator< DefaultContainerType, Plugins >::convert_rank_to_communicator ( int const rank,
Communicator< DefaultContainerType, Plugins > const & other_comm ) const
inline

Convert a rank from this communicator to the rank in another communicator.

Parameters
rankThe rank in this communicator
other_commThe communicator to convert the rank to
Returns
The rank in other_comm

◆ create_subcommunicators() [1/2]

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
Communicator kamping::Communicator< DefaultContainerType, Plugins >::create_subcommunicators ( RankRanges const & rank_ranges) const
inline

Create (sub-)communicators using a sparse representation for the ranks contained in the subcommunicators.

This split method requires globally available information on the ranks in the split communicators. A rank r must know all other ranks which will be part of the subcommunicator to which r will belong. This information can be used by the MPI implementation to execute a communicator split more efficiently. The method must be called by all ranks in the communicator.

Parameters
rank_rangesContains the ranks that will be part of this rank's new (sub-)communicator in a sparse representation via rank ranges each consisting of (first rank, last rank and stride). All ranks specified in ranks_in_own_group must have an identical ranks_in_own_group argument. Furthermore, this set must not be empty.
Returns
Communicator wrapping the newly split MPI communicator.

◆ create_subcommunicators() [2/2]

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
template<typename Ranks >
Communicator kamping::Communicator< DefaultContainerType, Plugins >::create_subcommunicators ( Ranks const & ranks_in_own_group) const
inline

Create subcommunicators.

This method requires globally available information on the ranks in the subcommunicators. A rank r must know all other ranks which will be part of the subcommunicator to which r will belong. This information can be used by the MPI implementation to execute a communicator split more efficiently. The method must be called by all ranks in the communicator.

Template Parameters
RanksContiguous container storing integers.
Parameters
ranks_in_own_groupContains the ranks that will be part of this rank's new (sub-)communicator. All ranks specified in ranks_in_own_group must have an identical ranks_in_own_group argument. Furthermore, this set must not be empty.
Returns
Communicator wrapping the newly split MPI communicator.

◆ disown_mpi_communicator()

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
MPI_Comm kamping::Communicator< DefaultContainerType, Plugins >::disown_mpi_communicator ( )
inline

Disowns the wrapped MPI_Comm, i.e. it will not be freed in the destructor.

Returns
MPI communicator corresponding to this communicator.

◆ group()

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
Group kamping::Communicator< DefaultContainerType, Plugins >::group ( ) const
inline

Return the group associated with this communicator.

Returns
The group associated with this communicator.

◆ is_root() [1/3]

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
bool kamping::Communicator< DefaultContainerType, Plugins >::is_root ( ) const
inline

Check if this rank is the root rank.

Returns
Return true if this rank is the root rank.

◆ is_root() [2/3]

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
bool kamping::Communicator< DefaultContainerType, Plugins >::is_root ( int const root) const
inline

Check if this rank is the root rank.

Returns
Return true if this rank is the root rank.
Parameters
rootThe custom root's rank.

◆ is_root() [3/3]

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
bool kamping::Communicator< DefaultContainerType, Plugins >::is_root ( size_t const root) const
inline

Check if this rank is the root rank.

Returns
Return true if this rank is the root rank.
Parameters
rootThe custom root's rank.

◆ is_same_on_all_ranks()

template<template< typename... > typename DefaultContainerType, template< typename, template< typename... > typename > typename... Plugins>
template<typename Value >
bool kamping::Communicator< DefaultContainerType, Plugins >::is_same_on_all_ranks ( Value const & value) const

Checks if all ranks provide the same value to this collective.

This collective function checks if all ranks have called it with the same value. The result is returned on all ranks.

Template Parameters
ValueType of the value to check. Must be comparable with operator==.
Parameters
valueThe value of this rank. This value is compared with the ones provided by all other ranks.
Returns
true if all ranks have provided the same value, false otherwise.

◆ is_valid_rank() [1/2]

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
bool kamping::Communicator< DefaultContainerType, Plugins >::is_valid_rank ( int const rank) const
inline

Checks if a rank is a valid rank for this communicator, i.e., if the rank is in [0, size).

Returns
true if rank in [0,size) and false otherwise.

◆ is_valid_rank() [2/2]

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
bool kamping::Communicator< DefaultContainerType, Plugins >::is_valid_rank ( size_t const rank) const
inline

Checks if a rank is a valid rank for this communicator, i.e., if the rank is in [0, size).

Returns
true if rank in [0,size) and false otherwise.

◆ mpi_communicator()

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
MPI_Comm kamping::Communicator< DefaultContainerType, Plugins >::mpi_communicator ( ) const
inline

MPI communicator corresponding to this communicator.

Returns
MPI communicator corresponding to this communicator.

◆ num_numa_nodes()

template<template< typename... > typename DefaultContainerType, template< typename, template< typename... > typename > typename... Plugins>
size_t kamping::Communicator< DefaultContainerType, Plugins >::num_numa_nodes ( ) const

Number of NUMA nodes (different shared memory regions) in this communicator. This operation is expensive (communicator splitting and communication). You should cache the result if you need it multiple times.

Returns
Number of compute nodes (hostnames) in this communicator.

◆ operator=() [1/2]

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
Communicator & kamping::Communicator< DefaultContainerType, Plugins >::operator= ( Communicator< DefaultContainerType, Plugins > && other)
inline

Move assignment operator.

Parameters
otherThe Communicator to move.

◆ operator=() [2/2]

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
Communicator & kamping::Communicator< DefaultContainerType, Plugins >::operator= ( Communicator< DefaultContainerType, Plugins > const & other)
inline

Copy assignment operator. Behaves according to the copy constructor.

Parameters
otherThe Communicator to copy.

◆ processor_name()

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
std::string kamping::Communicator< DefaultContainerType, Plugins >::processor_name ( ) const
inline

Get this 'processor's' name using MPI_Get_processor_name.

Returns
This 'processor's' name. Nowadays, this oftentimes is the hostname.

◆ rank()

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
size_t kamping::Communicator< DefaultContainerType, Plugins >::rank ( ) const
inline

Rank of the current MPI process in the communicator as size_t.

Returns
Rank of the current MPI process in the communicator as size_t.

◆ rank_shifted_checked()

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
size_t kamping::Communicator< DefaultContainerType, Plugins >::rank_shifted_checked ( int const distance) const
inline

Computes a rank that is distance ranks away from this MPI thread's current rank and checks if this is valid rank in this communicator.

The resulting rank is valid, iff it is at least zero and less than this communicator's size. The distance can be negative. Unlike rank_shifted_cyclic(), this does not guarantee a valid rank but can indicate if the resulting rank is not valid.

Parameters
distanceAmount current rank is decreased or increased by.
Returns
Rank if rank is in [0, size of communicator) and ASSERT/EXCEPTION? otherwise.

◆ rank_shifted_cyclic()

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
size_t kamping::Communicator< DefaultContainerType, Plugins >::rank_shifted_cyclic ( int const distance) const
inline

Computes a rank that is some ranks apart from this MPI thread's rank modulo the communicator's size.

When we need to compute a rank that is greater (or smaller) than this communicator's rank, we can use this function. It computes the rank that is distance ranks appart. However, this function always returns a valid rank, as it computes the rank in a circular fashion, i.e., $ new\_rank=(rank + distance) \% size $.

Parameters
distanceDistance of the new rank to the rank of this MPI thread.
Returns
The circular rank that is distance ranks apart from this MPI threads rank.

◆ rank_signed()

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
int kamping::Communicator< DefaultContainerType, Plugins >::rank_signed ( ) const
inline

Rank of the current MPI process in the communicator as int.

Returns
Rank of the current MPI process in the communicator as int.

◆ root() [1/3]

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
size_t kamping::Communicator< DefaultContainerType, Plugins >::root ( ) const
inline

Default root for MPI operations that require a root as size_t.

Returns
Default root for MPI operations that require a root as size_t.

◆ root() [2/3]

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
void kamping::Communicator< DefaultContainerType, Plugins >::root ( int const new_root)
inline

Set a new root for MPI operations that require a root.

Parameters
new_rootThe new default root.

◆ root() [3/3]

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
void kamping::Communicator< DefaultContainerType, Plugins >::root ( size_t const new_root)
inline

Set a new root for MPI operations that require a root.

Parameters
new_rootThe new default root.

◆ root_signed()

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
int kamping::Communicator< DefaultContainerType, Plugins >::root_signed ( ) const
inline

Default root for MPI operations that require a root as int.

Returns
Default root for MPI operations that require a root as int.

◆ size()

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
size_t kamping::Communicator< DefaultContainerType, Plugins >::size ( ) const
inline

Number of MPI processes in this communicator as size_t.

Returns
Number of MPI processes in this communicator as size_t.

◆ size_signed()

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
int kamping::Communicator< DefaultContainerType, Plugins >::size_signed ( ) const
inline

Number of MPI processes in this communicator as int.

Returns
Number of MPI processes in this communicator int.

◆ split()

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
Communicator kamping::Communicator< DefaultContainerType, Plugins >::split ( int const color,
int const key = 0 ) const
inline

Split the communicator in different colors.

Parameters
colorAll ranks that have the same color will be in the same new communicator.
keyBy default, ranks in the new communicator are determined by the underlying MPI library (if key is 0). Otherwise, ranks are ordered the same way the keys are ordered.
Returns
Communicator wrapping the newly split MPI communicator.

◆ split_by_type()

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
Communicator kamping::Communicator< DefaultContainerType, Plugins >::split_by_type ( int const type) const
inline

Split the communicator by the specified type (e.g., shared memory)

Parameters
typeThe only standard-conform value is MPI_COMM_TYPE_SHARED but your MPI implementation might support other types. For example: OMPI_COMM_TYPE_L3CACHE.

◆ split_to_shared_memory()

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
Communicator kamping::Communicator< DefaultContainerType, Plugins >::split_to_shared_memory ( ) const
inline

Split the communicator into NUMA nodes.

Returns
Communicator wrapping the newly split MPI communicator. Each rank will be in the communicator corresponding to its NUMA node.

◆ swap()

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
void kamping::Communicator< DefaultContainerType, Plugins >::swap ( Communicator< DefaultContainerType, Plugins > & other)
inline

Swaps the Communicator with another Communicator.

Parameters
otherThe Communicator to swap with.

Member Data Documentation

◆ _owns_mpi_comm

template<template< typename... > typename DefaultContainerType = std::vector, template< typename, template< typename... > typename > typename... Plugins>
bool kamping::Communicator< DefaultContainerType, Plugins >::_owns_mpi_comm
protected

Whether the Communicator Objects owns the contained MPI_Comm, i.e. whether it is allowed to free it in the destructor.


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