|
BioCMAMC-ST
|
Namespace to correclty wrap MPI C API for modern C++. More...
Namespaces | |
| namespace | Async |
Classes | |
| class | HostIterationPayload |
| Represents the payload of data on the host side for an iteration. More... | |
| class | IterationPayload |
| Represents the payload of data exchanged during an iteration. More... | |
Concepts | |
| concept | POD_t |
Enumerations | |
| enum class | SIGNALS : char { STOP , RUN , NOP , DUMP } |
Functions | |
| template<POD_t DataType> | |
| static int | _send_unsafe (DataType *buf, size_t buf_size, size_t dest, size_t tag=0) noexcept |
| Sends raw data to a destination in an unsafe manner. | |
| template<POD_t DataType> | |
| int | send (DataType data, size_t dest, size_t tag=0) |
| Sends a single instance of data to a destination. | |
| template<POD_t DataType> | |
| int | send_v (std::span< const DataType > data, size_t dest, size_t tag=0, bool send_size=true) noexcept |
| Sends a vector of data to a destination. | |
| template<POD_t DataType> | |
| std::optional< DataType > | recv (size_t src, MPI_Status *status=nullptr, size_t tag=0) noexcept |
| Receives a single data item from a source. | |
| template<POD_t DataType> | |
| int | recv_span (std::span< DataType > buf, size_t src, MPI_Status *status=nullptr, size_t tag=0) noexcept |
| Receives data into a span buffer. | |
| template<POD_t DataType> | |
| DataType | try_recv (size_t src, MPI_Status *status=nullptr, size_t tag=0) |
| Attempts to receive a single data item from a source. | |
| template<POD_t T> | |
| std::optional< std::vector< T > > | recv_v (size_t source, MPI_Status *status=nullptr, size_t tag=0) noexcept |
| Receives a vector of data items from a source. | |
| template<POD_t T> | |
| std::vector< T > | try_recv_v (size_t src, MPI_Status *status=nullptr, size_t tag=0) |
| Attempts to receive a vector of data items from a source. | |
| template<POD_t T> | |
| int | _broadcast_unsafe (T *data, size_t _size, size_t root) |
| Broadcasts raw data to all processes in an unsafe manner. | |
| template<POD_t DataType> | |
| int | broadcast (DataType &data, size_t root) noexcept |
| Broadcasts a single data item to all processes. | |
| template<POD_t T> | |
| int | broadcast_span (std::span< T > data, size_t root) |
| Broadcasts data stored in a span to all processes. | |
| template<POD_t... Args> | |
| void | host_dispatch (const ExecInfo &info, SIGNALS sign, Args &&... args) |
| Dispatches a task to the host with signal and arguments. | |
| template<POD_t T> | |
| std::vector< T > | _gather_unsafe (T *src_data, size_t size, size_t n_rank, size_t root=0) |
| Gathers raw data from all processes in an unsafe manner. | |
| template<POD_t T> | |
| int | _gather_unsafe_to_buffer (T *dest, T *src_data, size_t size, size_t root=0) noexcept |
| template<POD_t T> | |
| std::vector< T > | gather (std::span< T > local_data, size_t n_rank, size_t root=0) |
| Gathers data from all processes. | |
| template<POD_t T> | |
| void | gather_span (std::span< T > dest, std::span< const T > local_data, size_t root=0) |
| template<NumberType T> | |
| T | gather_reduce (T data, size_t root=0) |
| Gathers and reduces data to a single value. | |
| template<NumberType T> | |
| T | all_reduce (T data) |
| template<POD_t T> | |
| std::vector< T > | gather_v (const std::vector< T > &local_data, size_t n_rank, size_t root=0) |
| Gathers a vector of data from all processes. | |
| template<POD_t T> | |
| int | broadcast (std::vector< T > &data, size_t root, size_t current_rank) |
| int | critical_error () noexcept |
| void | barrier () noexcept |
| void | finalize () noexcept |
| bool | is_initialized () noexcept |
| template<typename T> | |
| constexpr MPI_Datatype | get_type () noexcept |
Namespace to correclty wrap MPI C API for modern C++.
|
strong |
|
nodiscard |
Broadcasts raw data to all processes in an unsafe manner.
This function sends raw data of type T from the root process to all other processes. It performs only basic safety checks
| T | The type of the data to broadcast. |
| data | Pointer to the data to be broadcasted. |
| _size | The size of the data in bytes. |
| root | The identifier of the root process that initiates the broadcast. |
| std::vector< T > WrapMPI::_gather_unsafe | ( | T * | src_data, |
| size_t | size, | ||
| size_t | n_rank, | ||
| size_t | root = 0 ) |
Gathers raw data from all processes in an unsafe manner.
This function collects raw data of type T from all processes into a single vector on the root process. It performs no safety checks and assumes the input pointers and sizes are valid.
| T | The type of the data to gather. |
| src_data | Pointer to the local data to be gathered. |
| size | The size of the local data in bytes. |
| n_rank | The number of processes in the communicator. |
| root | The identifier of the root process that gathers the data (default is 0). |
|
noexcept |
|
staticnodiscardnoexcept |
Sends raw data to a destination in an unsafe manner.
This function sends raw data of type DataType to the specified destination. It assumes the provided buffer and its size are valid
| DataType | A type satisfying the POD concept. |
| buf | Pointer to the buffer containing data to send. |
| buf_size | The size of the buffer in bytes. |
| dest | The destination identifier for the data. |
| tag | Optional tag to identify the message (default is 0). |
| T WrapMPI::all_reduce | ( | T | data | ) |
|
noexcept |
|
noexcept |
Broadcasts a single data item to all processes.
This function sends a single object of type DataType from the root process to all other processes.
| DataType | A type satisfying the POD concept. |
| data | Reference to the data to be broadcasted. |
| root | The identifier of the root process that initiates the broadcast. |
| int WrapMPI::broadcast | ( | std::vector< T > & | data, |
| size_t | root, | ||
| size_t | current_rank ) |
| int WrapMPI::broadcast_span | ( | std::span< T > | data, |
| size_t | root ) |
Broadcasts data stored in a span to all processes.
This function sends data stored in a std::span from the root process to all other processes.
| T | The type of the data to broadcast. |
| data | A std::span containing the data to be broadcasted. |
| root | The identifier of the root process that initiates the broadcast. |
|
noexcept |
|
noexcept |
| std::vector< T > WrapMPI::gather | ( | std::span< T > | local_data, |
| size_t | n_rank, | ||
| size_t | root = 0 ) |
Gathers data from all processes.
This function collects data stored in a std::span from all processes into a single vector on the root process.
| T | The type of the data to gather. |
| local_data | A std::span containing the local data to be gathered. |
| n_rank | The number of processes in the communicator. |
| root | The identifier of the root process that gathers the data (default is 0). |
| T WrapMPI::gather_reduce | ( | T | data, |
| size_t | root = 0 ) |
Gathers and reduces data to a single value.
This function collects data of type T from all processes, performs a reduction operation (sum), and returns the result to the root process.
| T | A type satisfying the NumberType concept. |
| data | The local data to be reduced and gathered. |
| root | The identifier of the root process that gathers and reduces the data (default is 0). |
| void WrapMPI::gather_span | ( | std::span< T > | dest, |
| std::span< const T > | local_data, | ||
| size_t | root = 0 ) |
| std::vector< T > WrapMPI::gather_v | ( | const std::vector< T > & | local_data, |
| size_t | n_rank, | ||
| size_t | root = 0 ) |
Gathers a vector of data from all processes.
This function collects vectors of data from all processes into a single vector on the root process.
| T | The type of the data to gather. |
| local_data | A vector containing the local data to be gathered. |
| n_rank | The number of processes in the communicator. |
| root | The identifier of the root process that gathers the data (default is 0). |
|
constexprnoexcept |
| void WrapMPI::host_dispatch | ( | const ExecInfo & | info, |
| SIGNALS | sign, | ||
| Args &&... | args ) |
Dispatches a task to the host with signal and arguments.
This function sends execution information and arguments to the host for processing, triggered by a specific signal.
| Args | Variadic template types for the arguments. |
|
noexcept |
|
noexcept |
Receives a single data item from a source.
This function attempts to receive a single object of type DataType from the specified source. If the receive operation fails, it returns an empty std::optional.
| DataType | A type satisfying the POD concept. |
| src | The source identifier from which to receive data. |
| status | Optional pointer to an MPI_Status structure to retrieve message details (default is nullptr). |
| tag | Optional tag to filter messages (default is 0). |
|
noexcept |
Receives data into a span buffer.
This function attempts to receive data into the provided span buffer. The buffer must be pre-allocated and of sufficient size to hold the incoming data.
| DataType | A type satisfying the POD concept. |
| buf | A std::span representing the destination buffer for the data. |
| src | The source identifier from which to receive data. |
| status | Optional pointer to an MPI_Status structure to retrieve message details (default is nullptr). |
| tag | Optional tag to filter messages (default is 0). |
|
noexcept |
Receives a vector of data items from a source.
This function attempts to receive a vector of objects of type T from the specified source. If the receive operation fails, it returns an empty std::optional.
| T | The type of data to receive. |
| source | The source identifier from which to receive data. |
| status | Optional pointer to an MPI_Status structure to retrieve message details (default is nullptr). |
| tag | Optional tag to filter messages (default is 0). |
| int WrapMPI::send | ( | DataType | data, |
| size_t | dest, | ||
| size_t | tag = 0 ) |
Sends a single instance of data to a destination.
This function sends a single object of type DataType to the specified destination.
| DataType | A type satisfying the POD concept. |
| data | The data object to send. |
| dest | The destination identifier for the data. |
| tag | Optional tag to identify the message (default is 0). |
|
noexcept |
Sends a vector of data to a destination.
This function sends a collection of objects of type DataType to the specified destination. Optionally, the size of the collection can also be transmitted.
| DataType | A type satisfying the POD concept. |
| data | A std::span containing the data to send. |
| dest | The destination identifier for the data. |
| tag | Optional tag to identify the message (default is 0). |
| send_size | If true, the size of the data will be sent before the data itself (default is true). |
| DataType WrapMPI::try_recv | ( | size_t | src, |
| MPI_Status * | status = nullptr, | ||
| size_t | tag = 0 ) |
Attempts to receive a single data item from a source.
This function attempts to receive a single object of type DataType from the specified source. If the operation fails, it throws an exception.
| DataType | A type satisfying the POD concept. |
| src | The source identifier from which to receive data. |
| status | Optional pointer to an MPI_Status structure to retrieve message details (default is nullptr). |
| tag | Optional tag to filter messages (default is 0). |
| An | exception if the receive operation fails. |
| std::vector< T > WrapMPI::try_recv_v | ( | size_t | src, |
| MPI_Status * | status = nullptr, | ||
| size_t | tag = 0 ) |
Attempts to receive a vector of data items from a source.
This function attempts to receive a vector of objects of type T from the specified source. If the operation fails, it throws an exception.
| T | The type of data to receive. |
| src | The source identifier from which to receive data. |
| status | Optional pointer to an MPI_Status structure to retrieve message details (default is nullptr). |
| tag | Optional tag to filter messages (default is 0). |
| An | exception if the receive operation fails. |