Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::mpi::intercommunicator Class Reference

Communication facilities among processes in different groups. More...

#include <intercommunicator.hpp>

Inheritance diagram for boost::mpi::intercommunicator:
Collaboration diagram for boost::mpi::intercommunicator:

Public Member Functions

 intercommunicator (const MPI_Comm &comm, comm_create_kind kind)
 Build a new Boost.MPI intercommunicator based on the MPI intercommunicator comm. More...
 
 intercommunicator (const communicator &local, int local_leader, const communicator &peer, int remote_leader)
 Constructs a new intercommunicator whose local group is local and whose remote group is peer. More...
 
int local_size () const
 Returns the size of the local group, i.e., the number of local processes that are part of the group. More...
 
boost::mpi::group local_group () const
 Returns the local group, containing all of the local processes in this intercommunicator. More...
 
int local_rank () const
 Returns the rank of this process within the local group. More...
 
int remote_size () const
 Returns the size of the remote group, i.e., the number of processes that are part of the remote group. More...
 
boost::mpi::group remote_group () const
 Returns the remote group, containing all of the remote processes in this intercommunicator. More...
 
communicator merge (bool high) const
 Merge the local and remote groups in this intercommunicator into a new intracommunicator containing the union of the processes in both groups. More...
 
int rank () const
 Determine the rank of the executing process in a communicator. More...
 
int size () const
 Determine the number of processes in a communicator. More...
 
boost::mpi::group group () const
 This routine constructs a new group whose members are the processes within this communicator. More...
 
template<typename T >
void send (int dest, int tag, const T &value) const
 Send data to another process. More...
 
template<typename T >
void send (int dest, int tag, const skeleton_proxy< T > &proxy) const
 Send the skeleton of an object. More...
 
template<typename T >
void send (int dest, int tag, const T *values, int n) const
 Send an array of values to another process. More...
 
void send (int dest, int tag) const
 Send a message to another process without any data. More...
 
template<>
BOOST_MPI_DECL void send (int dest, int tag, const packed_oarchive &ar) const
 INTERNAL ONLY. More...
 
template<>
BOOST_MPI_DECL void send (int dest, int tag, const packed_skeleton_oarchive &ar) const
 INTERNAL ONLY. More...
 
template<>
BOOST_MPI_DECL void send (int dest, int tag, const content &c) const
 INTERNAL ONLY. More...
 
template<typename T >
status recv (int source, int tag, T &value) const
 Receive data from a remote process. More...
 
template<typename T >
status recv (int source, int tag, const skeleton_proxy< T > &proxy) const
 Receive a skeleton from a remote process. More...
 
template<typename T >
status recv (int source, int tag, skeleton_proxy< T > &proxy) const
 Receive a skeleton from a remote process. More...
 
template<typename T >
status recv (int source, int tag, T *values, int n) const
 Receive an array of values from a remote process. More...
 
status recv (int source, int tag) const
 Receive a message from a remote process without any data. More...
 
template<>
BOOST_MPI_DECL status recv (int source, int tag, packed_iarchive &ar) const
 INTERNAL ONLY. More...
 
template<>
BOOST_MPI_DECL status recv (int source, int tag, packed_skeleton_iarchive &ar) const
 INTERNAL ONLY. More...
 
template<>
BOOST_MPI_DECL status recv (int source, int tag, const content &c) const
 INTERNAL ONLY. More...
 
template<>
status recv (int source, int tag, content &c) const
 INTERNAL ONLY. More...
 
template<typename T >
request isend (int dest, int tag, const T &value) const
 Send a message to a remote process without blocking. More...
 
template<typename T >
request isend (int dest, int tag, const skeleton_proxy< T > &proxy) const
 Send the skeleton of an object without blocking. More...
 
template<typename T >
request isend (int dest, int tag, const T *values, int n) const
 Send an array of values to another process without blocking. More...
 
request isend (int dest, int tag) const
 Send a message to another process without any data without blocking. More...
 
template<>
BOOST_MPI_DECL request isend (int dest, int tag, const packed_oarchive &ar) const
 INTERNAL ONLY. More...
 
template<>
BOOST_MPI_DECL request isend (int dest, int tag, const packed_skeleton_oarchive &ar) const
 INTERNAL ONLY. More...
 
template<>
BOOST_MPI_DECL request isend (int dest, int tag, const content &c) const
 INTERNAL ONLY. More...
 
template<typename T >
request irecv (int source, int tag, T &value) const
 Prepare to receive a message from a remote process. More...
 
template<typename T >
request irecv (int source, int tag, T *values, int n) const
 Initiate receipt of an array of values from a remote process. More...
 
request irecv (int source, int tag) const
 Initiate receipt of a message from a remote process that carries no data. More...
 
template<>
BOOST_MPI_DECL request irecv (int source, int tag, packed_skeleton_iarchive &ar) const
 INTERNAL ONLY. More...
 
template<>
BOOST_MPI_DECL request irecv (int source, int tag, const content &c) const
 INTERNAL ONLY. More...
 
template<>
request irecv (int source, int tag, content &c) const
 INTERNAL ONLY. More...
 
status probe (int source=any_source, int tag=any_tag) const
 Waits until a message is available to be received. More...
 
optional< statusiprobe (int source=any_source, int tag=any_tag) const
 Determine if a message is available to be received. More...
 
void barrier () const
 Wait for all processes within a communicator to reach the barrier. More...
 
 operator bool () const
 Determine if this communicator is valid for communication. More...
 
 operator MPI_Comm () const
 Access the MPI communicator associated with a Boost.MPI communicator. More...
 
communicator split (int color) const
 Split the communicator into multiple, disjoint communicators each of which is based on a particular color. More...
 
communicator split (int color, int key) const
 Split the communicator into multiple, disjoint communicators each of which is based on a particular color. More...
 
optional< intercommunicatoras_intercommunicator () const
 Determine if the communicator is in fact an intercommunicator and, if so, return that intercommunicator. More...
 
optional< graph_communicatoras_graph_communicator () const
 Determine if the communicator has a graph topology and, if so, return that graph_communicator. More...
 
bool has_cartesian_topology () const
 Determines whether this communicator has a Cartesian topology. More...
 
void abort (int errcode) const
 Abort all tasks in the group of this communicator. More...
 

Protected Member Functions

template<typename T >
void send_impl (int dest, int tag, const T &value, mpl::true_) const
 INTERNAL ONLY. More...
 
template<typename T >
void send_impl (int dest, int tag, const T &value, mpl::false_) const
 INTERNAL ONLY. More...
 
template<typename T >
void array_send_impl (int dest, int tag, const T *values, int n, mpl::true_) const
 INTERNAL ONLY. More...
 
template<typename T >
void array_send_impl (int dest, int tag, const T *values, int n, mpl::false_) const
 INTERNAL ONLY. More...
 
template<typename T >
request isend_impl (int dest, int tag, const T &value, mpl::true_) const
 INTERNAL ONLY. More...
 
template<typename T >
request isend_impl (int dest, int tag, const T &value, mpl::false_) const
 INTERNAL ONLY. More...
 
template<typename T >
request array_isend_impl (int dest, int tag, const T *values, int n, mpl::true_) const
 INTERNAL ONLY. More...
 
template<typename T >
request array_isend_impl (int dest, int tag, const T *values, int n, mpl::false_) const
 INTERNAL ONLY. More...
 
template<typename T >
status recv_impl (int source, int tag, T &value, mpl::true_) const
 INTERNAL ONLY. More...
 
template<typename T >
status recv_impl (int source, int tag, T &value, mpl::false_) const
 INTERNAL ONLY. More...
 
template<typename T >
status array_recv_impl (int source, int tag, T *values, int n, mpl::true_) const
 INTERNAL ONLY. More...
 
template<typename T >
status array_recv_impl (int source, int tag, T *values, int n, mpl::false_) const
 INTERNAL ONLY. More...
 
template<typename T >
request irecv_impl (int source, int tag, T &value, mpl::true_) const
 INTERNAL ONLY. More...
 
template<typename T >
request irecv_impl (int source, int tag, T &value, mpl::false_) const
 INTERNAL ONLY. More...
 
template<typename T >
request array_irecv_impl (int source, int tag, T *values, int n, mpl::true_) const
 INTERNAL ONLY. More...
 
template<typename T >
request array_irecv_impl (int source, int tag, T *values, int n, mpl::false_) const
 INTERNAL ONLY. More...
 

Protected Attributes

shared_ptr< MPI_Comm > comm_ptr
 

Friends

class communicator
 

Detailed Description

Communication facilities among processes in different groups.

The intercommunicator class provides communication facilities among processes from different groups. An intercommunicator is always associated with two process groups: one "local" process group, containing the process that initiates an MPI operation (e.g., the sender in a send operation), and one "remote" process group, containing the process that is the target of the MPI operation.

While intercommunicators have essentially the same point-to-point operations as intracommunicators (the latter communicate only within a single process group), all communication with intercommunicators occurs between the processes in the local group and the processes in the remote group; communication within a group must use a different (intra-)communicator.

Constructor & Destructor Documentation

boost::mpi::intercommunicator::intercommunicator ( const MPI_Comm &  comm,
comm_create_kind  kind 
)
inline

Build a new Boost.MPI intercommunicator based on the MPI intercommunicator comm.

comm may be any valid MPI intercommunicator. If comm is MPI_COMM_NULL, an empty communicator (that cannot be used for communication) is created and the kind parameter is ignored. Otherwise, the kind parameter determines how the Boost.MPI communicator will be related to comm:

  • If kind is comm_duplicate, duplicate comm to create a new communicator. This new communicator will be freed when the Boost.MPI communicator (and all copies of it) is destroyed. This option is only permitted if the underlying MPI implementation supports MPI 2.0; duplication of intercommunicators is not available in MPI 1.x.
  • If kind is comm_take_ownership, take ownership of comm. It will be freed automatically when all of the Boost.MPI communicators go out of scope.
  • If kind is comm_attach, this Boost.MPI communicator will reference the existing MPI communicator comm but will not free comm when the Boost.MPI communicator goes out of scope. This option should only be used when the communicator is managed by the user.
boost::mpi::intercommunicator::intercommunicator ( const communicator local,
int  local_leader,
const communicator peer,
int  remote_leader 
)

Constructs a new intercommunicator whose local group is local and whose remote group is peer.

The intercommunicator can then be used to communicate between processes in the two groups. This constructor is equivalent to a call to MPI_Intercomm_create.

Parameters
localThe intracommunicator containing all of the processes that will go into the local group.
local_leaderThe rank within the local intracommunicator that will serve as its leader.
peerThe intracommunicator containing all of the processes that will go into the remote group.
remote_leaderThe rank within the peer group that will serve as its leader.

Member Function Documentation

void boost::mpi::communicator::abort ( int  errcode) const
inherited

Abort all tasks in the group of this communicator.

Makes a "best attempt" to abort all of the tasks in the group of this communicator. Depending on the underlying MPI implementation, this may either abort the entire program (and possibly return errcode to the environment) or only abort some processes, allowing the others to continue. Consult the documentation for your MPI implementation. This is equivalent to a call to MPI_Abort

Parameters
errcodeThe error code to return from aborted processes.
Returns
Will not return.
template<typename T >
request boost::mpi::communicator::array_irecv_impl ( int  source,
int  tag,
T values,
int  n,
mpl::true_   
) const
protectedinherited

INTERNAL ONLY.

We're receiving a type that has an associated MPI datatype, so we map directly to that datatype.

References BOOST_MPI_CHECK_RESULT, and boost::mpi::request::m_requests.

Referenced by boost::mpi::communicator::irecv().

template<typename T >
request boost::mpi::communicator::array_irecv_impl ( int  source,
int  tag,
T values,
int  n,
mpl::false_   
) const
protectedinherited

INTERNAL ONLY.

We're receiving a type that does not have an associated MPI datatype, so it must have been serialized then sent as MPI_PACKED. We'll receive it and then deserialize.

References BOOST_MPI_CHECK_RESULT, boost::proto::envns_::data, boost::mpi::request::m_data, boost::mpi::request::m_handler, and boost::mpi::request::m_requests.

template<typename T >
request boost::mpi::communicator::array_isend_impl ( int  dest,
int  tag,
const T values,
int  n,
mpl::true_   
) const
protectedinherited

INTERNAL ONLY.

We're sending an array of a type that has an associated MPI datatype, so we map directly to that datatype.

References BOOST_MPI_CHECK_RESULT, and boost::mpi::request::m_requests.

Referenced by boost::mpi::communicator::isend().

template<typename T >
request boost::mpi::communicator::array_isend_impl ( int  dest,
int  tag,
const T values,
int  n,
mpl::false_   
) const
protectedinherited

INTERNAL ONLY.

We're sending an array of a type that does not have an associated MPI datatype, so it must be serialized then sent as MPI_PACKED data, to be deserialized on the receiver side.

References boost::mpi::communicator::isend(), boost::mpi::request::m_data, and boost::serialization::make_array().

template<typename T >
status boost::mpi::communicator::array_recv_impl ( int  source,
int  tag,
T values,
int  n,
mpl::true_   
) const
protectedinherited

INTERNAL ONLY.

We're receiving an array of a type that has an associated MPI datatype, so we map directly to that datatype.

References BOOST_MPI_CHECK_RESULT, and boost::mpi::status::m_status.

Referenced by boost::mpi::communicator::recv().

template<typename T >
status boost::mpi::communicator::array_recv_impl ( int  source,
int  tag,
T values,
int  n,
mpl::false_   
) const
protectedinherited

INTERNAL ONLY.

We're receiving a type that does not have an associated MPI datatype, so it must have been serialized then sent as MPI_PACKED. We'll receive it and then deserialize.

References count, boost::mpi::status::m_count, boost::mpi::communicator::recv(), and boost::throw_exception().

template<typename T >
void boost::mpi::communicator::array_send_impl ( int  dest,
int  tag,
const T values,
int  n,
mpl::true_   
) const
protectedinherited

INTERNAL ONLY.

We're sending an array of a type that has an associated MPI datatype, so we map directly to that datatype.

References BOOST_MPI_CHECK_RESULT.

Referenced by boost::mpi::communicator::send().

template<typename T >
void boost::mpi::communicator::array_send_impl ( int  dest,
int  tag,
const T values,
int  n,
mpl::false_   
) const
protectedinherited

INTERNAL ONLY.

We're sending an array of a type that does not have an associated MPI datatype, so it must be serialized then sent as MPI_PACKED data, to be deserialized on the receiver side.

References boost::serialization::make_array(), and boost::mpi::communicator::send().

optional<graph_communicator> boost::mpi::communicator::as_graph_communicator ( ) const
inherited

Determine if the communicator has a graph topology and, if so, return that graph_communicator.

Even though the communicators have different types, they refer to the same underlying communication space and can be used interchangeably for communication.

Returns
an optional containing the graph communicator, if this communicator does in fact have a graph topology. Otherwise, returns an empty optional.
optional<intercommunicator> boost::mpi::communicator::as_intercommunicator ( ) const
inherited

Determine if the communicator is in fact an intercommunicator and, if so, return that intercommunicator.

Returns
an optional containing the intercommunicator, if this communicator is in fact an intercommunicator. Otherwise, returns an empty optional.
void boost::mpi::communicator::barrier ( ) const
inherited

Wait for all processes within a communicator to reach the barrier.

This routine is a collective operation that blocks each process until all processes have entered it, then releases all of the processes "simultaneously". It is equivalent to MPI_Barrier.

boost::mpi::group boost::mpi::communicator::group ( ) const
inherited

This routine constructs a new group whose members are the processes within this communicator.

Equivalent to calling MPI_Comm_group.

bool boost::mpi::communicator::has_cartesian_topology ( ) const
inherited

Determines whether this communicator has a Cartesian topology.

optional<status> boost::mpi::communicator::iprobe ( int  source = any_source,
int  tag = any_tag 
) const
inherited

Determine if a message is available to be received.

This operation determines if a message matching (source, tag) is available to be received. If so, it returns information about that message; otherwise, it returns immediately with an empty optional. The functionality is equivalent to MPI_Iprobe. To wait until a message is available, use wait.

Parameters
sourceDetermine if there is a message available from this rank. If any_source, then the message returned may come from any source.
tagDetermine if there is a message available with the given tag. If any_tag, then the message returned may have any tag.
Returns
If a matching message is available, returns information about that message. Otherwise, returns an empty boost::optional.
template<typename T >
request boost::mpi::communicator::irecv ( int  source,
int  tag,
T value 
) const
inherited

Prepare to receive a message from a remote process.

The irecv method is functionally identical to the recv method and receive data in the same way, except that irecv will not block while waiting for data to be transmitted. Instead, it immediately returns a request object that allows one to query the status of the receive or wait until it has completed.

Parameters
sourceThe process that will be sending data. This will either be a process rank within the communicator or the constant any_source, indicating that we can receive the message from any process.
tagThe tag that matches a particular kind of message sent by the source process. This may be any tag value permitted by send. Alternatively, the argument may be the constant any_tag, indicating that this receive matches a message with any tag.
valueWill contain the value of the message after a successful receive. The type of this value must match the value transmitted by the sender, unless the sender transmitted a packed archive or skeleton: in these cases, the sender transmits a packed_oarchive or packed_skeleton_oarchive and the destination receives a packed_iarchive or packed_skeleton_iarchive, respectively.
Returns
a request object that describes this communication.

References boost::mpi::communicator::irecv_impl().

template<typename T >
request boost::mpi::communicator::irecv ( int  source,
int  tag,
T values,
int  n 
) const
inherited

Initiate receipt of an array of values from a remote process.

This routine initiates a receive operation for an array of values transmitted by process source with the given tag.

Parameters
sourceThe process that will be sending data. This will either be a process rank within the communicator or the constant any_source, indicating that we can receive the message from any process.
tagThe tag that matches a particular kind of message sent by the source process. This may be any tag value permitted by send. Alternatively, the argument may be the constant any_tag, indicating that this receive matches a message with any tag.
valuesWill contain the values in the message after a successful receive. The type of these elements must match the type of the elements transmitted by the sender.
nThe number of values that can be stored into the values array. This shall not be smaller than the number of elements transmitted by the sender.
Returns
a request object that describes this communication.

References boost::mpi::communicator::array_irecv_impl().

request boost::mpi::communicator::irecv ( int  source,
int  tag 
) const
inherited

Initiate receipt of a message from a remote process that carries no data.

This routine initiates a receive operation for a message from process source with the given tag that carries no data.

Parameters
sourceThe process that will be sending the message. This will either be a process rank within the communicator or the constant any_source, indicating that we can receive the message from any process.
tagThe tag that matches a particular kind of message sent by the source process. This may be any tag value permitted by send. Alternatively, the argument may be the constant any_tag, indicating that this receive matches a message with any tag.
Returns
a request object that describes this communication.
template<>
BOOST_MPI_DECL request boost::mpi::communicator::irecv ( int  source,
int  tag,
packed_skeleton_iarchive ar 
) const
inherited

INTERNAL ONLY.

template<>
BOOST_MPI_DECL request boost::mpi::communicator::irecv ( int  source,
int  tag,
const content c 
) const
inherited

INTERNAL ONLY.

template<>
request boost::mpi::communicator::irecv ( int  source,
int  tag,
content c 
) const
inlineinherited
template<typename T >
request boost::mpi::communicator::irecv_impl ( int  source,
int  tag,
T value,
mpl::true_   
) const
protectedinherited

INTERNAL ONLY.

We're receiving a type that has an associated MPI datatype, so we map directly to that datatype.

References BOOST_MPI_CHECK_RESULT, and boost::mpi::request::m_requests.

Referenced by boost::mpi::communicator::irecv().

template<typename T >
request boost::mpi::communicator::irecv_impl ( int  source,
int  tag,
T value,
mpl::false_   
) const
protectedinherited

INTERNAL ONLY.

We're receiving a type that does not have an associated MPI datatype, so it must have been serialized then sent as MPI_PACKED. We'll receive it and then deserialize.

References BOOST_MPI_CHECK_RESULT, boost::proto::envns_::data, boost::mpi::request::m_data, boost::mpi::request::m_handler, and boost::mpi::request::m_requests.

template<typename T >
request boost::mpi::communicator::isend ( int  dest,
int  tag,
const T value 
) const
inherited

Send a message to a remote process without blocking.

The isend method is functionality identical to the send method and transmits data in the same way, except that isend will not block while waiting for the data to be transmitted. Instead, a request object will be immediately returned, allowing one to query the status of the communication or wait until it has completed.

Parameters
destThe rank of the remote process to which the data will be sent.
tagThe tag that will be associated with this message. Tags may be any integer between zero and an implementation-defined upper limit. This limit is accessible via environment::max_tag().
valueThe value that will be transmitted to the receiver. The type T of this value must meet the aforementioned criteria for transmission.
Returns
a request object that describes this communication.

References boost::mpi::communicator::isend_impl().

Referenced by boost::mpi::communicator::array_isend_impl(), and boost::mpi::communicator::isend_impl().

template<typename T >
request boost::mpi::communicator::isend ( int  dest,
int  tag,
const skeleton_proxy< T > &  proxy 
) const
inherited

Send the skeleton of an object without blocking.

This routine is functionally identical to the send method for skeleton_proxy objects except that isend will not block while waiting for the data to be transmitted. Instead, a request object will be immediately returned, allowing one to query the status of the communication or wait until it has completed.

The semantics of this routine are equivalent to a non-blocking send of a packed_skeleton_oarchive storing the skeleton of the object.

Parameters
destThe rank of the remote process to which the skeleton will be sent.
tagThe tag that will be associated with this message. Tags may be any integer between zero and an implementation-defined upper limit. This limit is accessible via environment::max_tag().
proxyThe skeleton_proxy containing a reference to the object whose skeleton will be transmitted.
Returns
a request object that describes this communication.
template<typename T >
request boost::mpi::communicator::isend ( int  dest,
int  tag,
const T values,
int  n 
) const
inherited

Send an array of values to another process without blocking.

This routine is functionally identical to the send method for arrays except that isend will not block while waiting for the data to be transmitted. Instead, a request object will be immediately returned, allowing one to query the status of the communication or wait until it has completed.

Parameters
destThe process rank of the remote process to which the data will be sent.
tagThe tag that will be associated with this message. Tags may be any integer between zero and an implementation-defined upper limit. This limit is accessible via environment::max_tag().
valuesThe array of values that will be transmitted to the receiver. The type T of these values must be mapped to an MPI data type.
nThe number of values stored in the array. The destination process must call receive with at least this many elements to correctly receive the message.
Returns
a request object that describes this communication.

References boost::mpi::communicator::array_isend_impl().

request boost::mpi::communicator::isend ( int  dest,
int  tag 
) const
inherited

Send a message to another process without any data without blocking.

This routine is functionally identical to the send method for sends with no data, except that isend will not block while waiting for the message to be transmitted. Instead, a request object will be immediately returned, allowing one to query the status of the communication or wait until it has completed.

Parameters
destThe process rank of the remote process to which the message will be sent.
tagThe tag that will be associated with this message. Tags may be any integer between zero and an implementation-defined upper limit. This limit is accessible via environment::max_tag().
Returns
a request object that describes this communication.
template<>
BOOST_MPI_DECL request boost::mpi::communicator::isend ( int  dest,
int  tag,
const packed_oarchive ar 
) const
inherited

INTERNAL ONLY.

template<>
BOOST_MPI_DECL request boost::mpi::communicator::isend ( int  dest,
int  tag,
const packed_skeleton_oarchive ar 
) const
inherited

INTERNAL ONLY.

template<>
BOOST_MPI_DECL request boost::mpi::communicator::isend ( int  dest,
int  tag,
const content c 
) const
inherited

INTERNAL ONLY.

template<typename T >
request boost::mpi::communicator::isend_impl ( int  dest,
int  tag,
const T value,
mpl::true_   
) const
protectedinherited

INTERNAL ONLY.

We're sending a type that has an associated MPI datatype, so we map directly to that datatype.

References BOOST_MPI_CHECK_RESULT, and boost::mpi::request::m_requests.

Referenced by boost::mpi::communicator::isend().

template<typename T >
request boost::mpi::communicator::isend_impl ( int  dest,
int  tag,
const T value,
mpl::false_   
) const
protectedinherited

INTERNAL ONLY.

We're sending a type that does not have an associated MPI datatype, so it must be serialized then sent as MPI_PACKED data, to be deserialized on the receiver side.

References boost::mpi::communicator::isend(), boost::mpi::request::m_data, and boost::program_options::value().

boost::mpi::group boost::mpi::intercommunicator::local_group ( ) const

Returns the local group, containing all of the local processes in this intercommunicator.

int boost::mpi::intercommunicator::local_rank ( ) const
inline

Returns the rank of this process within the local group.

int boost::mpi::intercommunicator::local_size ( ) const
inline

Returns the size of the local group, i.e., the number of local processes that are part of the group.

References boost::size().

communicator boost::mpi::intercommunicator::merge ( bool  high) const

Merge the local and remote groups in this intercommunicator into a new intracommunicator containing the union of the processes in both groups.

This method is equivalent to MPI_Intercomm_merge.

Parameters
highWhether the processes in this group should have the higher rank numbers than the processes in the other group. Each of the processes within a particular group shall have the same "high" value.
Returns
the new, merged intracommunicator
boost::mpi::communicator::operator bool ( ) const
inlineinherited

Determine if this communicator is valid for communication.

Evaluates true in a boolean context if this communicator is valid for communication, i.e., does not represent MPI_COMM_NULL. Otherwise, evaluates false.

boost::mpi::communicator::operator MPI_Comm ( ) const
inherited

Access the MPI communicator associated with a Boost.MPI communicator.

This routine permits the implicit conversion from a Boost.MPI communicator to an MPI communicator.

Returns
The associated MPI communicator.
status boost::mpi::communicator::probe ( int  source = any_source,
int  tag = any_tag 
) const
inherited

Waits until a message is available to be received.

This operation waits until a message matching (source, tag) is available to be received. It then returns information about that message. The functionality is equivalent to MPI_Probe. To check if a message is available without blocking, use iprobe.

Parameters
sourceDetermine if there is a message available from this rank. If any_source, then the message returned may come from any source.
tagDetermine if there is a message available with the given tag. If any_tag, then the message returned may have any tag.
Returns
Returns information about the first message that matches the given criteria.
template<typename T >
status boost::mpi::communicator::recv ( int  source,
int  tag,
T value 
) const
inherited

Receive data from a remote process.

This routine blocks until it receives a message from the process source with the given tag. The type T of the value must be suitable for transmission over MPI, which includes serializable types, types that can be mapped to MPI data types (including most built-in C++ types), packed MPI archives, skeletons, and content associated with skeletons; see the documentation of send for a complete description.

Parameters
sourceThe process that will be sending data. This will either be a process rank within the communicator or the constant any_source, indicating that we can receive the message from any process.
tagThe tag that matches a particular kind of message sent by the source process. This may be any tag value permitted by send. Alternatively, the argument may be the constant any_tag, indicating that this receive matches a message with any tag.
valueWill contain the value of the message after a successful receive. The type of this value must match the value transmitted by the sender, unless the sender transmitted a packed archive or skeleton: in these cases, the sender transmits a packed_oarchive or packed_skeleton_oarchive and the destination receives a packed_iarchive or packed_skeleton_iarchive, respectively.
Returns
Information about the received message.

References boost::mpi::communicator::recv_impl().

Referenced by boost::mpi::communicator::array_recv_impl(), boost::mpi::detail::gather_impl(), boost::mpi::communicator::recv_impl(), and boost::mpi::detail::upper_lower_scan().

template<typename T >
status boost::mpi::communicator::recv ( int  source,
int  tag,
const skeleton_proxy< T > &  proxy 
) const
inherited

Receive a skeleton from a remote process.

This routine blocks until it receives a message from the process source with the given tag containing a skeleton.

Parameters
sourceThe process that will be sending data. This will either be a process rank within the communicator or the constant any_source, indicating that we can receive the message from any process.
tagThe tag that matches a particular kind of message sent by the source process. This may be any tag value permitted by send. Alternatively, the argument may be the constant any_tag, indicating that this receive matches a message with any tag.
proxyThe skeleton_proxy containing a reference to the object that will be reshaped to match the received skeleton.
Returns
Information about the received message.
template<typename T >
status boost::mpi::communicator::recv ( int  source,
int  tag,
skeleton_proxy< T > &  proxy 
) const
inherited

Receive a skeleton from a remote process.

This routine blocks until it receives a message from the process source with the given tag containing a skeleton.

Parameters
sourceThe process that will be sending data. This will either be a process rank within the communicator or the constant any_source, indicating that we can receive the message from any process.
tagThe tag that matches a particular kind of message sent by the source process. This may be any tag value permitted by send. Alternatively, the argument may be the constant any_tag, indicating that this receive matches a message with any tag.
proxyThe skeleton_proxy containing a reference to the object that will be reshaped to match the received skeleton.
Returns
Information about the received message.
template<typename T >
status boost::mpi::communicator::recv ( int  source,
int  tag,
T values,
int  n 
) const
inherited

Receive an array of values from a remote process.

This routine blocks until it receives an array of values from the process source with the given tag. If the type T is

Parameters
sourceThe process that will be sending data. This will either be a process rank within the communicator or the constant any_source, indicating that we can receive the message from any process.
tagThe tag that matches a particular kind of message sent by the source process. This may be any tag value permitted by send. Alternatively, the argument may be the constant any_tag, indicating that this receive matches a message with any tag.
valuesWill contain the values in the message after a successful receive. The type of these elements must match the type of the elements transmitted by the sender.
nThe number of values that can be stored into the values array. This shall not be smaller than the number of elements transmitted by the sender.
Exceptions
std::range_errorif the message to be received contains more than n values.
Returns
Information about the received message.

References boost::mpi::communicator::array_recv_impl().

status boost::mpi::communicator::recv ( int  source,
int  tag 
) const
inherited

Receive a message from a remote process without any data.

This routine blocks until it receives a message from the process source with the given tag.

Parameters
sourceThe process that will be sending the message. This will either be a process rank within the communicator or the constant any_source, indicating that we can receive the message from any process.
tagThe tag that matches a particular kind of message sent by the source process. This may be any tag value permitted by send. Alternatively, the argument may be the constant any_tag, indicating that this receive matches a message with any tag.
Returns
Information about the received message.
template<>
BOOST_MPI_DECL status boost::mpi::communicator::recv ( int  source,
int  tag,
packed_iarchive ar 
) const
inherited

INTERNAL ONLY.

template<>
BOOST_MPI_DECL status boost::mpi::communicator::recv ( int  source,
int  tag,
packed_skeleton_iarchive ar 
) const
inherited

INTERNAL ONLY.

template<>
BOOST_MPI_DECL status boost::mpi::communicator::recv ( int  source,
int  tag,
const content c 
) const
inherited

INTERNAL ONLY.

template<>
status boost::mpi::communicator::recv ( int  source,
int  tag,
content c 
) const
inlineinherited
template<typename T >
status boost::mpi::communicator::recv_impl ( int  source,
int  tag,
T value,
mpl::true_   
) const
protectedinherited

INTERNAL ONLY.

We're receiving a type that has an associated MPI datatype, so we map directly to that datatype.

References BOOST_MPI_CHECK_RESULT, and boost::mpi::status::m_status.

Referenced by boost::mpi::communicator::recv().

template<typename T >
status boost::mpi::communicator::recv_impl ( int  source,
int  tag,
T value,
mpl::false_   
) const
protectedinherited

INTERNAL ONLY.

We're receiving a type that does not have an associated MPI datatype, so it must have been serialized then sent as MPI_PACKED. We'll receive it and then deserialize.

References boost::mpi::communicator::recv(), and boost::program_options::value().

boost::mpi::group boost::mpi::intercommunicator::remote_group ( ) const

Returns the remote group, containing all of the remote processes in this intercommunicator.

int boost::mpi::intercommunicator::remote_size ( ) const

Returns the size of the remote group, i.e., the number of processes that are part of the remote group.

template<typename T >
void boost::mpi::communicator::send ( int  dest,
int  tag,
const T value 
) const
inherited

Send data to another process.

This routine executes a potentially blocking send with tag tag to the process with rank dest. It can be received by the destination process with a matching recv call.

The given value must be suitable for transmission over MPI. There are several classes of types that meet these requirements:

  • Types with mappings to MPI data types: If is_mpi_datatype<T> is convertible to mpl::true_, then value will be transmitted using the MPI data type get_mpi_datatype<T>(). All primitive C++ data types that have MPI equivalents, e.g., int, float, char, double, etc., have built-in mappings to MPI data types. You may turn a Serializable type with fixed structure into an MPI data type by specializing is_mpi_datatype for your type.
  • Serializable types: Any type that provides the serialize() functionality required by the Boost.Serialization library can be transmitted and received.
  • Packed archives and skeletons: Data that has been packed into an mpi::packed_oarchive or the skeletons of data that have been backed into an mpi::packed_skeleton_oarchive can be transmitted, but will be received as mpi::packed_iarchive and mpi::packed_skeleton_iarchive, respectively, to allow the values (or skeletons) to be extracted by the destination process.
  • Content: Content associated with a previously-transmitted skeleton can be transmitted by send and received by recv. The receiving process may only receive content into the content of a value that has been constructed with the matching skeleton.

For types that have mappings to an MPI data type (including the concent of a type), an invocation of this routine will result in a single MPI_Send call. For variable-length data, e.g., serialized types and packed archives, two messages will be sent via MPI_Send: one containing the length of the data and the second containing the data itself. Note that the transmission mode for variable-length data is an implementation detail that is subject to change.

Parameters
destThe rank of the remote process to which the data will be sent.
tagThe tag that will be associated with this message. Tags may be any integer between zero and an implementation-defined upper limit. This limit is accessible via environment::max_tag().
valueThe value that will be transmitted to the receiver. The type T of this value must meet the aforementioned criteria for transmission.

References boost::mpi::communicator::send_impl().

Referenced by boost::mpi::communicator::array_send_impl(), boost::mpi::detail::gather_impl(), boost::mpi::communicator::send_impl(), and boost::mpi::detail::upper_lower_scan().

template<typename T >
void boost::mpi::communicator::send ( int  dest,
int  tag,
const skeleton_proxy< T > &  proxy 
) const
inherited

Send the skeleton of an object.

This routine executes a potentially blocking send with tag tag to the process with rank dest. It can be received by the destination process with a matching recv call. This variation on send will be used when a send of a skeleton is explicitly requested via code such as:

comm.send(dest, tag, skeleton(object));

The semantics of this routine are equivalent to that of sending a packed_skeleton_oarchive storing the skeleton of the object.

Parameters
destThe rank of the remote process to which the skeleton will be sent.
tagThe tag that will be associated with this message. Tags may be any integer between zero and an implementation-defined upper limit. This limit is accessible via environment::max_tag().
proxyThe skeleton_proxy containing a reference to the object whose skeleton will be transmitted.
template<typename T >
void boost::mpi::communicator::send ( int  dest,
int  tag,
const T values,
int  n 
) const
inherited

Send an array of values to another process.

This routine executes a potentially blocking send of an array of data with tag tag to the process with rank dest. It can be received by the destination process with a matching array recv call.

If T is an MPI datatype, an invocation of this routine will be mapped to a single call to MPI_Send, using the datatype get_mpi_datatype<T>().

Parameters
destThe process rank of the remote process to which the data will be sent.
tagThe tag that will be associated with this message. Tags may be any integer between zero and an implementation-defined upper limit. This limit is accessible via environment::max_tag().
valuesThe array of values that will be transmitted to the receiver. The type T of these values must be mapped to an MPI data type.
nThe number of values stored in the array. The destination process must call receive with at least this many elements to correctly receive the message.

References boost::mpi::communicator::array_send_impl().

void boost::mpi::communicator::send ( int  dest,
int  tag 
) const
inherited

Send a message to another process without any data.

This routine executes a potentially blocking send of a message to another process. The message contains no extra data, and can therefore only be received by a matching call to recv().

Parameters
destThe process rank of the remote process to which the message will be sent.
tagThe tag that will be associated with this message. Tags may be any integer between zero and an implementation-defined upper limit. This limit is accessible via environment::max_tag().
template<>
BOOST_MPI_DECL void boost::mpi::communicator::send ( int  dest,
int  tag,
const packed_oarchive ar 
) const
inherited

INTERNAL ONLY.

template<>
BOOST_MPI_DECL void boost::mpi::communicator::send ( int  dest,
int  tag,
const packed_skeleton_oarchive ar 
) const
inherited

INTERNAL ONLY.

template<>
BOOST_MPI_DECL void boost::mpi::communicator::send ( int  dest,
int  tag,
const content c 
) const
inherited

INTERNAL ONLY.

template<typename T >
void boost::mpi::communicator::send_impl ( int  dest,
int  tag,
const T value,
mpl::true_   
) const
protectedinherited

INTERNAL ONLY.

We're sending a type that has an associated MPI datatype, so we map directly to that datatype.

References BOOST_MPI_CHECK_RESULT.

Referenced by boost::mpi::communicator::send().

template<typename T >
void boost::mpi::communicator::send_impl ( int  dest,
int  tag,
const T value,
mpl::false_   
) const
protectedinherited

INTERNAL ONLY.

We're sending a type that does not have an associated MPI datatype, so it must be serialized then sent as MPI_PACKED data, to be deserialized on the receiver side.

References boost::mpi::communicator::send(), and boost::program_options::value().

communicator boost::mpi::communicator::split ( int  color) const
inherited

Split the communicator into multiple, disjoint communicators each of which is based on a particular color.

This is a collective operation that returns a new communicator that is a subgroup of this. This routine is functionally equivalent to MPI_Comm_split.

Parameters
colorThe color of this process. All processes with the same color value will be placed into the same group.
Returns
A new communicator containing all of the processes in this that have the same color.
communicator boost::mpi::communicator::split ( int  color,
int  key 
) const
inherited

Split the communicator into multiple, disjoint communicators each of which is based on a particular color.

This is a collective operation that returns a new communicator that is a subgroup of this. This routine is functionally equivalent to MPI_Comm_split.

Parameters
colorThe color of this process. All processes with the same color value will be placed into the same group.
keyA key value that will be used to determine the ordering of processes with the same color in the resulting communicator. If omitted, the rank of the processes in this will determine the ordering of processes in the resulting group.
Returns
A new communicator containing all of the processes in this that have the same color.

Friends And Related Function Documentation

friend class communicator
friend

Member Data Documentation

shared_ptr<MPI_Comm> boost::mpi::communicator::comm_ptr
protectedinherited

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