KaMPIng 0.1.1
Flexible and (near) zero-overhead C++ bindings for MPI
|
KaMPIng's collective wrappers. More...
KaMPIng's collective wrappers.
auto kamping::Communicator< DefaultContainerType, Plugins >::allgather | ( | Args... | args | ) | const |
Wrapper for MPI_Allgather
.
This wrapper for MPI_Allgather
collects the same amount of data from each rank to all ranks. It is semantically equivalent to performing a gather()
followed by a broadcast of the collected data.
The following parameters are required:
The following parameters are optional:
MPI
datatype to use as send type. If omitted, the MPI
datatype is derived automatically based on send_buf's underlying value_type
.recv_counts * communicator size
.MPI
datatype to use as recv type. If omitted, the MPI
datatype is derived automatically based on recv_buf's underlying value_type
.In-place allgather is supported by passing send_recv_buf() as parameter. This changes the requirements for the other parameters, see Communicator::allgather_inplace.
Args | Automatically deduced template parameters. |
args | All required and any number of the optional parameters described above. |
The underlying container/storage of an out parameter encapsulating a data buffer (e.g. recv_buf
/recv_counts
, etc.) will be resized according to the parameter's resize policy:
If a send_/recv_/send_recv_type
parameter is provided, kamping::BufferResizePolicy::no_resize for receive buffers is required, as KaMPIng can no longer ensure a 1:1 mapping between MPI_Datatype and the underlying storage's C++ type.
auto kamping::Communicator< DefaultContainerType, Plugins >::allgather_inplace | ( | Args... | args | ) | const |
Wrapper for the in-place version of MPI_Allgather
.
This variant must be called collectively by all ranks in the communicator.
The following parameters are required:
size() * send_recv_count
and the data contributed by each rank is already at the correct location in the buffer.The following parameters are optional:
send_recv_buf.size() / size()
is used.MPI
datatype to use as send and recv type. If omitted, the MPI
datatype is derived automatically based on send_recv_buf's underlying value_type
.Args | Automatically deduced template parameters. |
args | All required and any number of the optional parameters described above. |
The underlying container/storage of an out parameter encapsulating a data buffer (e.g. recv_buf
/recv_counts
, etc.) will be resized according to the parameter's resize policy:
If a send_/recv_/send_recv_type
parameter is provided, kamping::BufferResizePolicy::no_resize for receive buffers is required, as KaMPIng can no longer ensure a 1:1 mapping between MPI_Datatype and the underlying storage's C++ type.
auto kamping::Communicator< DefaultContainerType, Plugins >::allgatherv | ( | Args... | args | ) | const |
Wrapper for MPI_Allgatherv
.
This wrapper for MPI_Allgatherv
collects possibly different amounts of data from each rank to all ranks. It is semantically equivalent to performing a gatherv()
followed by a broadcast of the collected data.
The following parameters are required:
The following parameters are optional but result in communication overhead if omitted:
The following parameters are optional:
MPI
datatype to use as send type. If omitted, the MPI
datatype is derived automatically based on send_buf's underlying value_type
.max(recv_counts[i] + recv_displs[i])
for i
in [0, communicator size)
.recv_counts[i]
elements starting at recv_buf[recv_displs[i]]
will be received from rank i
. If omitted, this is calculated as the exclusive prefix-sum of recv_counts
.MPI
datatype to use as recv type. If omitted, the MPI
datatype is derived automatically based on recv_buf's underlying value_type
.Args | Automatically deduced template parameters. |
args | All required and any number of the optional parameters described above. |
The underlying container/storage of an out parameter encapsulating a data buffer (e.g. recv_buf
/recv_counts
, etc.) will be resized according to the parameter's resize policy:
If a send_/recv_/send_recv_type
parameter is provided, kamping::BufferResizePolicy::no_resize for receive buffers is required, as KaMPIng can no longer ensure a 1:1 mapping between MPI_Datatype and the underlying storage's C++ type.
auto kamping::Communicator< DefaultContainerType, Plugins >::allreduce | ( | Args... | args | ) | const |
Wrapper for MPI_Allreduce
; which is semantically a reduction followed by a broadcast.
This wraps MPI_Allreduce
. The operation combines the elements in the input buffer provided via kamping::send_buf()
and returns the combined value on all ranks.
The following parameters are required:
The following parameters are optional:
MPI
datatype to use as send type. If omitted, the MPI
datatype is derived automatically based on send_buf's underlying value_type
.In-place allreduce is supported by providing send_recv_buf()
instead of send_buf()
and recv_buf()
. For details on the in-place version, see Communicator::allreduce_inplace().
Args | Automatically deduced template parameters. |
args | All required and any number of the optional parameters described above. |
The underlying container/storage of an out parameter encapsulating a data buffer (e.g. recv_buf
/recv_counts
, etc.) will be resized according to the parameter's resize policy:
If a send_/recv_/send_recv_type
parameter is provided, kamping::BufferResizePolicy::no_resize for receive buffers is required, as KaMPIng can no longer ensure a 1:1 mapping between MPI_Datatype and the underlying storage's C++ type.
auto kamping::Communicator< DefaultContainerType, Plugins >::allreduce_inplace | ( | Args... | args | ) | const |
Wrapper for the in-place version of Communicator::allreduce().
This variant must be called collectively by all ranks in the communicator. It is semantically equivalent to Communicator::allreduce(), but the input buffer is used as the output buffer. This means that the input buffer is overwritten with the result of the reduction.
The following parameters are required:
The following parameters are optional:
send_recv_buf
is used. This parameter is mandatory if kamping::send_recv_type() is given.MPI
datatype to use as send type. If omitted, the MPI
datatype is derived automatically based on send_recv_buf
's underlying value_type
.Args | Automatically deduced template parameters. |
args | All required and any number of the optional parameters described above. |
The underlying container/storage of an out parameter encapsulating a data buffer (e.g. recv_buf
/recv_counts
, etc.) will be resized according to the parameter's resize policy:
If a send_/recv_/send_recv_type
parameter is provided, kamping::BufferResizePolicy::no_resize for receive buffers is required, as KaMPIng can no longer ensure a 1:1 mapping between MPI_Datatype and the underlying storage's C++ type.
auto kamping::Communicator< DefaultContainerType, Plugins >::allreduce_single | ( | Args... | args | ) | const |
Wrapper for MPI_Allreduce
; which is semantically a reduction followed by a broadcast.
Calling allreduce_single() is a shorthand for calling allreduce() with a kamping::send_buf() of size 1. It always issues only a single MPI_Allreduce
call, as no receive counts have to be exchanged.
The following parameters are required:
Args | Automatically deduced template parameters. |
args | All required and any number of the optional parameters described above. |
auto kamping::Communicator< DefaultContainerType, Plugins >::alltoall | ( | Args... | args | ) | const |
Wrapper for MPI_Alltoall
.
This wrapper for MPI_Alltoall
sends the same amount of data from each rank to each rank. The following buffers are required:
The following parameters are optional:
recv_count * communicator size
is required.MPI
datatype to use as send type. If omitted, the MPI
datatype is derived automatically based on send_buf's underlying value_type
.MPI
datatype to use as recv type. If omitted, the MPI
datatype is derived automatically based on recv_buf's underlying value_type
.Inplace alltoall is supported by passing send_recv_buf as parameter. This changes the requirements for the other parameters, see Communicator::alltoall_inplace.
Args | Automatically deduced template parameters. |
args | All required and any number of the optional buffers described above. |
The underlying container/storage of an out parameter encapsulating a data buffer (e.g. recv_buf
/recv_counts
, etc.) will be resized according to the parameter's resize policy:
If a send_/recv_/send_recv_type
parameter is provided, kamping::BufferResizePolicy::no_resize for receive buffers is required, as KaMPIng can no longer ensure a 1:1 mapping between MPI_Datatype and the underlying storage's C++ type.
auto kamping::Communicator< DefaultContainerType, Plugins >::alltoall_inplace | ( | Args... | args | ) | const |
Wrapper for the in-place version of Communicator::alltoall.
This variant must be called collectively by all ranks in the communicator. It sends the same amount of data from each rank to each rank, using the same buffer for sending and receiving data.
The following parameteres are required:
The following parameters are optional:
MPI
datatype to use as send and recv type. If omitted, the MPI
datatype is derived automatically based on send_recv_buf's underlying value_type
.Args | Automatically deduced template parameters. |
args | All required and any number of the optional buffers described above. |
The underlying container/storage of an out parameter encapsulating a data buffer (e.g. recv_buf
/recv_counts
, etc.) will be resized according to the parameter's resize policy:
If a send_/recv_/send_recv_type
parameter is provided, kamping::BufferResizePolicy::no_resize for receive buffers is required, as KaMPIng can no longer ensure a 1:1 mapping between MPI_Datatype and the underlying storage's C++ type.
auto kamping::Communicator< DefaultContainerType, Plugins >::alltoallv | ( | Args... | args | ) | const |
Wrapper for MPI_Alltoallv
.
This wrapper for MPI_Alltoallv
sends the different amounts of data from each rank to each rank. The following buffers are required:
The following parameters are optional but result in communication overhead if omitted:
The following buffers are optional:
max(recv_counts[i] + recv_displs[i])
for i
in [0, communicator size)
elements is required.send_counts[i]
elements starting at send_buf[send_displs[i]]
will be sent to rank i
. If omitted, this is calculated as the exclusive prefix-sum of send_counts
.recv_counts[i]
elements starting at recv_buf[recv_displs[i]]
will be received from rank i
. If omitted, this is calculated as the exclusive prefix-sum of recv_counts
.MPI
datatype to use as send type. If omitted, the MPI
datatype is derived automatically based on send_buf's underlying value_type
.MPI
datatype to use as recv type. If omitted, the MPI
datatype is derived automatically based on recv_buf's underlying value_type
.Args | Automatically deduced template parameters. |
args | All required and any number of the optional buffers described above. |
The underlying container/storage of an out parameter encapsulating a data buffer (e.g. recv_buf
/recv_counts
, etc.) will be resized according to the parameter's resize policy:
If a send_/recv_/send_recv_type
parameter is provided, kamping::BufferResizePolicy::no_resize for receive buffers is required, as KaMPIng can no longer ensure a 1:1 mapping between MPI_Datatype and the underlying storage's C++ type.
void kamping::Communicator< DefaultContainerType, Plugins >::barrier | ( | Args... | args | ) | const |
Perform a MPI_Barrier
on this communicator.
Barrier takes no parameters. Any parameters passed will cause a compilation error.
The parameter pack prohibits the compiler from compiling this function when it's not used.
auto kamping::Communicator< DefaultContainerType, Plugins >::bcast | ( | Args... | args | ) | const |
Wrapper for MPI_Bcast
.
This wrapper for MPI_Bcast
sends data from the root to all other ranks.
The following buffer is required on the root rank:
bcast()
as it's used for deducing the value type. The buffer will be resized on non-root ranks according to the buffer's kamping::BufferResizePolicy.The following parameter is optional but causes additional communication if not present.
The following parameter are optional:
MPI
datatype to use as send type on the root PE and recv type on all non-root PEs. If omitted, the MPI
datatype is derived automatically based on send_recv_buf's underlying value_type
.Communicator
is used, see root().recv_value_type_tparam | The type that is received. Only required when no kamping::send_recv_buf() is given. |
Args | Automatically deduced template parameters. |
args | All required and any number of the optional parameters described above. |
The underlying container/storage of an out parameter encapsulating a data buffer (e.g. recv_buf
/recv_counts
, etc.) will be resized according to the parameter's resize policy:
If a send_/recv_/send_recv_type
parameter is provided, kamping::BufferResizePolicy::no_resize for receive buffers is required, as KaMPIng can no longer ensure a 1:1 mapping between MPI_Datatype and the underlying storage's C++ type.
auto kamping::Communicator< DefaultContainerType, Plugins >::bcast_single | ( | Args... | args | ) | const |
Wrapper for MPI_Bcast
.
This wrapper for MPI_Bcast
sends a single value from the root to all other ranks. Calling bcast_single()
is a shorthand for calling bcast(..., recv_counts(1))
. It always issues only a single MPI_Bcast
call, as no receive counts have to be exchanged.
The following buffer is required on the root rank:
bcast_single()
as it's used for deducing the value type.The following parameter is optional:
Communicator
is used, see root().recv_value_type_tparam | The type that is received. Only required when no kamping::send_recv_buf() is given. |
Args | Automatically deduced template parameters. |
args | All required and any number of the optional buffers described above. |
If you expand this function to not being only a simple wrapper around bcast, you have to write more unit tests!
auto kamping::Communicator< DefaultContainerType, Plugins >::exscan | ( | Args... | args | ) | const |
Wrapper for MPI_Exscan
.
exscan()
wraps MPI_Exscan
, which is used to perform an exclusive prefix reduction on data distributed across the calling processes. exscan()
returns in the recv_buf
of the process with rank , the reduction (calculated according to the function op
) of the values in the send_bufs
of processes with ranks (i.e. excluding i as opposed to scan()
). The value of the recv_buf
on rank 0 is set to the value of values_on_rank_0
if provided. If values_on_rank_0
is not provided and op
is a built-in operation on the data-type used, the value on rank 0 is set to the identity of that operation. If the operation is not built-in on the data-type used and no values_on_rank_0()
is provided, the contents of recv_buf
on rank 0 are undefined.
The following parameters are required:
The following parameters are optional:
send_recv_count
elements is required.MPI
datatype to use as data type in this operation. If omitted, the MPI
datatype is derived automatically based on send_buf's underlying value_type
. If the type is provided explicitly, the compatibility of the type and operation has to be ensured by the user.recv_buf
of rank 0. values_on_rank_0
must be a container of the same size as recv_buf
or a single value (which will be reused for all elements of the recv_buf
).In-place exscan is supported by providing send_recv_buf()
instead of send_buf()
and recv_buf()
. For details on the in-place version, see Communicator::exscan_inplace().
Args | Automatically deduced template parameters. |
args | All required and any number of the optional parameters described above. |
The underlying container/storage of an out parameter encapsulating a data buffer (e.g. recv_buf
/recv_counts
, etc.) will be resized according to the parameter's resize policy:
If a send_/recv_/send_recv_type
parameter is provided, kamping::BufferResizePolicy::no_resize for receive buffers is required, as KaMPIng can no longer ensure a 1:1 mapping between MPI_Datatype and the underlying storage's C++ type.
auto kamping::Communicator< DefaultContainerType, Plugins >::exscan_inplace | ( | Args... | args | ) | const |
Wrapper for the in-place version of Communicator::exscan().
This variant must be called collectively by all ranks in the communicator. It is semantically equivalent to Communicator::exscan(), but the input buffer is used as the output buffer. This means that the input buffer is overwritten with the result of the exscan.
The following parameters are required:
The following parameters are optional:
MPI
datatype to use as data type in this operation. If omitted, the MPI
datatype is derived automatically based on send_recv_buf's underlying value_type
.values_on_rank_0
must be a container of the same size as send_recv_buf
or a single value (which will be reused for all elements of the recv_buf
).Args | Automatically deduced template parameters. |
args | All required and any number of the optional parameters described above. |
The underlying container/storage of an out parameter encapsulating a data buffer (e.g. recv_buf
/recv_counts
, etc.) will be resized according to the parameter's resize policy:
If a send_/recv_/send_recv_type
parameter is provided, kamping::BufferResizePolicy::no_resize for receive buffers is required, as KaMPIng can no longer ensure a 1:1 mapping between MPI_Datatype and the underlying storage's C++ type.
auto kamping::Communicator< DefaultContainerType, Plugins >::exscan_single | ( | Args... | args | ) | const |
Wrapper for MPI_exscan
for single elements.
This is functionally equivalent to exscan()
but provided for uniformity with other operations (e.g. bcast_single()
). exscan_single()
wraps MPI_Exscan
, which is used to perform an exclusive prefix reduction on data distributed across the calling processes. exscan_single()
returns on the process with rank , the reduction (calculated according to the function op
) of the values in the send_bufs
of processes with ranks (i.e. excluding i as opposed to scan()
). The result on rank 0 is set to the value of values_on_rank_0
if provided. If values_on_rank_0
is not provided and op
is a built-in operation on the data-type used, the value on rank 0 is set to the identity of that operation. If the operation is not built-in on the data-type used and no values_on_rank_0()
is provided, the result on rank 0 is undefined.
The following parameters are required:
The following parameters are optional:
recv_buf
of rank 0.///Args | Automatically deduced template parameters. |
args | All required and any number of the optional buffers described above. |
If you expand this function to not being only a simple wrapper around exscan, you have to write more unit tests!
auto kamping::Communicator< DefaultContainerType, Plugins >::gather | ( | Args... | args | ) | const |
Wrapper for MPI_Gather
.
This wrapper for MPI_Gather
collects the same amount of data from each rank to a root.
The following arguments are required:
The following buffers are optional:
MPI
datatype to use as send type. If omitted, the MPI
datatype is derived automatically based on send_buf's underlying value_type
. This parameter is ignored on non-root ranks.MPI
datatype to use as recv type. If omitted, the MPI
datatype is derived automatically based on recv_buf's underlying value_type
.Communicator
is used, see root().Args | Automatically deduced template parameters. |
args | All required and any number of the optional parameters described above. |
The underlying container/storage of an out parameter encapsulating a data buffer (e.g. recv_buf
/recv_counts
, etc.) will be resized according to the parameter's resize policy:
If a send_/recv_/send_recv_type
parameter is provided, kamping::BufferResizePolicy::no_resize for receive buffers is required, as KaMPIng can no longer ensure a 1:1 mapping between MPI_Datatype and the underlying storage's C++ type.
auto kamping::Communicator< DefaultContainerType, Plugins >::gatherv | ( | Args... | args | ) | const |
Wrapper for MPI_Gatherv
.
This wrapper for MPI_Gatherv
collects possibly different amounts of data from each rank to a root.
The following arguments are required:
The following parameter is optional but results in communication overhead if omitted:
recv_counts(kamping::ignore)
, then the recv_counts
on root will be computed by a gather of all local send counts. This parameter is mandatory (as an in-parameter) if kamping::recv_type() is given.The following buffers are optional:
recv_counts[i]
elements starting at recv_buf[recv_displs[i]]
will be received from rank i
. If omitted, this is calculated as the exclusive prefix-sum of recv_counts
.Communicator
is used, see root().Args | Automatically deduced template parameters. |
args | All required and any number of the optional parameters described above. |
The underlying container/storage of an out parameter encapsulating a data buffer (e.g. recv_buf
/recv_counts
, etc.) will be resized according to the parameter's resize policy:
If a send_/recv_/send_recv_type
parameter is provided, kamping::BufferResizePolicy::no_resize for receive buffers is required, as KaMPIng can no longer ensure a 1:1 mapping between MPI_Datatype and the underlying storage's C++ type.
auto kamping::Communicator< DefaultContainerType, Plugins >::iallreduce | ( | Args... | args | ) | const |
Wrapper for MPI_Iallreduce
.
This wraps MPI_Iallreduce
. The operation combines the elements in the input buffer provided via kamping::send_buf()
and returns the combined value on all ranks.
The following parameters are required:
The following parameters are optional:
MPI
datatype to use as send type. If omitted, the MPI
datatype is derived automatically based on send_buf's underlying value_type
.Args | Automatically deduced template parameters. |
args | All required and any number of the optional parameters described above. |
The underlying container/storage of an out parameter encapsulating a data buffer (e.g. recv_buf
/recv_counts
, etc.) will be resized according to the parameter's resize policy:
If a send_/recv_/send_recv_type
parameter is provided, kamping::BufferResizePolicy::no_resize for receive buffers is required, as KaMPIng can no longer ensure a 1:1 mapping between MPI_Datatype and the underlying storage's C++ type.
auto kamping::Communicator< DefaultContainerType, Plugins >::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.
The following parameters are optional:
Args | Automatically deduced template parameters. |
args | All required and any number of the optional buffers described above. |
auto kamping::TopologyCommunicator< DefaultContainerType, Plugins >::neighbor_alltoall | ( | Args... | args | ) | const |
Wrapper for MPI_Neighbor_alltoall
.
This wrapper for MPI_Neighbor_alltoall
sends the same amount of data from a rank i to each of its neighbour j for which an edge (i,j) in the communication graph exists. The following buffers are required:
The following parameters are optional:
recv_count * in degree
is required.MPI
datatype to use as send type. If omitted, the MPI
datatype is derived automatically based on send_buf's underlying value_type
.MPI
datatype to use as recv type. If omitted, the MPI
datatype is derived automatically based on recv_buf's underlying value_type
.Args | Automatically deduced template parameters. |
args | All required and any number of the optional buffers described above. |
The underlying container/storage of an out parameter encapsulating a data buffer (e.g. recv_buf
/recv_counts
, etc.) will be resized according to the parameter's resize policy:
If a send_/recv_/send_recv_type
parameter is provided, kamping::BufferResizePolicy::no_resize for receive buffers is required, as KaMPIng can no longer ensure a 1:1 mapping between MPI_Datatype and the underlying storage's C++ type.
auto kamping::Communicator< DefaultContainerType, Plugins >::reduce | ( | Args... | args | ) | const |
This wraps \c MPI_Reduce. The operation combines the elements in the input buffer provided via \c kamping::send_buf() and returns the combined value on the root rank. The following parameters are required: - \ref kamping::send_buf() containing the data that is sent to each rank. This buffer has to be the same size at each rank. - \ref kamping::recv_buf() specifying a buffer for the output. This parameter is only required on the root rank. - \ref kamping::op() wrapping the operation to apply to the input. If \ref kamping::send_recv_type() is provided, the compatibility of the type and operation has to be ensured by the user. The following parameters are optional: - \ref kamping::send_recv_count() specifying how many elements of the buffer take part in the reduction. If omitted, the size of the send buffer is used as a default. This parameter is mandatory if \ref kamping::send_type() is given. - \ref kamping::send_recv_type() specifying the \c MPI datatype to use as send_recv type. If omitted, the \c MPI datatype is derived automatically based on send_buf's underlying \c value_type. - \ref kamping::root() the root rank. If not set, the default root process of the communicator will be used. @tparam Args Automatically deduced template parameters. @param args All required and any number of the optional parameters described above. @return Result object wrapping the output parameters to be returned by value. @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng. <hr> \ifile "/__w/kamping/kamping/docs/resize_policy.dox" \iline 1 #### Note on Resize Policy
The underlying container/storage of an out parameter encapsulating a data buffer (e.g. recv_buf
/recv_counts
, etc.) will be resized according to the parameter's resize policy:
If a send_/recv_/send_recv_type
parameter is provided, kamping::BufferResizePolicy::no_resize for receive buffers is required, as KaMPIng can no longer ensure a 1:1 mapping between MPI_Datatype and the underlying storage's C++ type.
auto kamping::Communicator< DefaultContainerType, Plugins >::reduce_single | ( | Args... | args | ) | const |
Wrapper for MPI_Reduce
.
Calling reduce_single() is a shorthand for calling reduce() with a kamping::send_buf() of size 1. It always issues only a single MPI_Reduce
call, as no receive counts have to be exchanged.
The following parameters are required:
The following parameters are optional:
Args | Automatically deduced template parameters. |
args | All required and any number of the optional buffers described above. |
auto kamping::Communicator< DefaultContainerType, Plugins >::scan | ( | Args... | args | ) | const |
This wraps \c MPI_Scan, which is used to perform an inclusive prefix reduction on data distributed across the calling processes. / \c scan() returns in \c recv_buf of the process with rank \c i, the reduction (calculated according to the function op) of the values in the sendbufs of processes with ranks \f$0, ..., i\f$ (inclusive). The following parameters are required: - \ref kamping::send_buf() containing the data for which to perform the scan. This buffer has to be the same size at each rank. - \ref kamping::op() wrapping the operation to apply to the input. If \ref kamping::send_recv_type() is provided explicitly, the compatibility of the type and operation has to be ensured by the user. The following parameters are optional: - \ref kamping::recv_buf() containing a buffer for the output. A buffer size of at least `send_recv_count` elements is required. - \ref kamping::send_recv_count() containing the number of elements to be processed in this operation. This parameter has to be the same at each rank. If omitted, the size of the send buffer will be used as send_recv_count. - \ref kamping::send_recv_type() specifying the \c MPI datatype to use as data type in this operation. If omitted, the \c MPI datatype is derived automatically based on send_buf's underlying \c value_type. In-place scan is supported by providing `send_recv_buf()` instead of `send_buf()` and `recv_buf()`. For details on the in-place version, see \ref Communicator::scan_inplace(). @tparam Args Automatically deduced template parameters. @param args All required and any number of the optional parameters described above. @return Result object wrapping the output parameters to be returned by value. @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng. <hr> \ifile "/__w/kamping/kamping/docs/resize_policy.dox" \iline 1 #### Note on Resize Policy
The underlying container/storage of an out parameter encapsulating a data buffer (e.g. recv_buf
/recv_counts
, etc.) will be resized according to the parameter's resize policy:
If a send_/recv_/send_recv_type
parameter is provided, kamping::BufferResizePolicy::no_resize for receive buffers is required, as KaMPIng can no longer ensure a 1:1 mapping between MPI_Datatype and the underlying storage's C++ type.
auto kamping::Communicator< DefaultContainerType, Plugins >::scan_inplace | ( | Args... | args | ) | const |
Wrapper for the in-place version of Communicator::scan().
This variant must be called collectively by all ranks in the communicator. It is semantically equivalent to Communicator::scan(), but the input buffer is used as the output buffer. This means that the input buffer is overwritten with the result of the scan.
The following parameters are required:
The following parameters are optional:
MPI
datatype to use as data type in this operation. If omitted, the MPI
datatype is derived automatically based on send_recv_buf's underlying value_type
.Args | Automatically deduced template parameters. |
args | All required and any number of the optional parameters described above. |
The underlying container/storage of an out parameter encapsulating a data buffer (e.g. recv_buf
/recv_counts
, etc.) will be resized according to the parameter's resize policy:
If a send_/recv_/send_recv_type
parameter is provided, kamping::BufferResizePolicy::no_resize for receive buffers is required, as KaMPIng can no longer ensure a 1:1 mapping between MPI_Datatype and the underlying storage's C++ type.
auto kamping::Communicator< DefaultContainerType, Plugins >::scan_single | ( | Args... | args | ) | const |
Wrapper for MPI_Scan
for single elements.
This is functionally equivalent to scan()
but provided for uniformity with other operations (e.g. bcast_single()
). scan_single()
wraps MPI_Scan
, which is used to perform an inclusive prefix reduction on data distributed across the calling processes. scan()
returns on the process with rank , the reduction (calculated according to the function op) of the values in the sendbufs of processes with ranks (inclusive).
The following parameters are required:
Args | Automatically deduced template parameters. |
args | All required and any number of the optional buffers described above. |
If you expand this function to not being only a simple wrapper around scan, you have to write more unit tests!
auto kamping::Communicator< DefaultContainerType, Plugins >::scatter | ( | Args... | args | ) | const |
This wrapper for \c MPI_Scatter distributes data on the root PE evenly across all PEs in the current communicator. The following parameters are mandatory on the root rank: - kamping::send_buf() containing the data to be evenly distributed across all PEs. The size of this buffer must be divisible by the number of PEs in the current communicator. Non-root PEs can omit a send buffer by passing `kamping::ignore<T>` as a parameter, or `T` as a template parameter to \ref kamping::send_buf(). The following parameters are optional but incur communication overhead if omitted: - kamping::recv_count() specifying the number of elements sent to each PE. If this parameter is omitted, the number of elements sent to each PE is computed based on the size of the \ref kamping::send_buf() on the root PE and broadcasted to other PEs. The following parameters are optional: - kamping::send_count() specifying how many elements are sent to each process. If omitted, the size of send buffer divided by communicator size is used. This parameter is mandatory if \ref kamping::send_type() is given. - \ref kamping::send_type() specifying the \c MPI datatype to use as send type. If omitted, the \c MPI datatype is derived automatically based on send_buf's underlying \c value_type. This parameter is ignored on non-root ranks. - kamping::recv_buf() containing the received data. - \ref kamping::recv_type() specifying the \c MPI datatype to use as recv type. If omitted, the \c MPI datatype is derived automatically based on recv_buf's underlying \c value_type. - kamping::root() specifying the rank of the root PE. If omitted, the default root PE of the communicator is used instead. @tparam recv_value_type_tparam The type that is received. Only required when no \ref kamping::send_buf() and no \ref kamping::recv_buf() is given. @tparam Args Automatically deduced template parameters. @param args All required and any number of the optional parameters described above. @return Result object wrapping the output parameters to be returned by value. @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng. <hr> \ifile "/__w/kamping/kamping/docs/resize_policy.dox" \iline 1 #### Note on Resize Policy
The underlying container/storage of an out parameter encapsulating a data buffer (e.g. recv_buf
/recv_counts
, etc.) will be resized according to the parameter's resize policy:
If a send_/recv_/send_recv_type
parameter is provided, kamping::BufferResizePolicy::no_resize for receive buffers is required, as KaMPIng can no longer ensure a 1:1 mapping between MPI_Datatype and the underlying storage's C++ type.
auto kamping::Communicator< DefaultContainerType, Plugins >::scatter_single | ( | Args... | args | ) | const |
Calling scatter_single() is a shorthand for calling scatter() with a kamping::send_buf() with the same size as the communicator.
The following parameters are required on the root rank:
The following parameters are optional:
recv_value_type_tparam | The type that is received. |
Args | Automatically deducted template parameters. |
args | All required and any number of the optional buffers described above. |
auto kamping::Communicator< DefaultContainerType, Plugins >::scatterv | ( | Args... | args | ) | const |
Wrapper for MPI_Scatterv
.
This wrapper for MPI_Scatterv
distributes data on the root PE across all PEs in the current communicator.
The following parameters are mandatory on the root rank:
kamping::ignore<T>
as a parameter, or T
as a template parameter to kamping::send_buf().The following parameter can be omitted at the cost of communication overhead (1x MPI_Scatter)
The following parameter can be omitted at the cost of computational overhead:
The following parameters are optional:
MPI
datatype to use as send type. If omitted, the MPI
datatype is derived automatically based on send_buf's underlying value_type
. This parameter is ignored on non-root ranks.MPI
datatype to use as recv type. If omitted, the MPI
datatype is derived automatically based on recv_buf's underlying value_type
.recv_value_type_tparam | The type that is received. Only required when no kamping::send_buf() and no kamping::recv_buf() is given. /// |
Args | Automatically deduced template parameters. |
args | All required and any number of the optional parameters described above. |
The underlying container/storage of an out parameter encapsulating a data buffer (e.g. recv_buf
/recv_counts
, etc.) will be resized according to the parameter's resize policy:
If a send_/recv_/send_recv_type
parameter is provided, kamping::BufferResizePolicy::no_resize for receive buffers is required, as KaMPIng can no longer ensure a 1:1 mapping between MPI_Datatype and the underlying storage's C++ type.