Template Class Gatherer¶
Defined in File Gatherer.hpp
Class Documentation¶
-
template<typename
T>
classuitsl::Gatherer¶ Gather data items from across threads and processes.
Uses a thread-safe container to record values from different threads within a process. Then uses a MPI
gathervcall to collect values from across processes. Arbitrary numbers of data items may be contributed from each thread and from each process.- Template Parameters
T: Value type to be gathered.
Public Functions
-
Gatherer(MPI_Datatype mpi_type_, MPI_Comm comm_ = MPI_COMM_WORLD)¶ - Parameters
mpi_type_: MPI datatype corresponding to .comm_: Set of MPI processes to gather values from.
-
void
Put(const T &item)¶ Add a data item to the collection that will be gathered from.
- Note
This call is thread-safe.
- Parameters
item: The data item to store.
-
std::optional<std::vector<T>>
Gather(const int root = 0)¶ Gather put data items from across threads and processes.
- Return
Gathered data items if root process, otherwise std::nullopt.
- Note
All processes within must make this call simultaneously.
- Note
Only a single thread from each process should make this call.
- Parameters
root: The process ID to gather to.