Mallard 0.8.0
Unstructured, GPU accelerated, high-order finite volume CFD solver
Mallard website
Loading...
Searching...
No Matches
comm.h File Reference

Process-level communication: MPI when built with Mallard_ENABLE_MPI, otherwise a single-rank stub with the same interface. More...

#include <array>
#include <cstddef>
#include <cstdint>
#include <span>
#include <vector>
#include <type_traits>

Go to the source code of this file.

Classes

class  comm::Session
 Initializes MPI on construction (unless it already is) and finalizes it on destruction if this session initialized it. Create one in main() before Kokkos is initialized, so Kokkos can map ranks to devices. More...
 
struct  comm::Received< T >
 What an exchange() received: the part from rank r is data[offsets[r], offsets[r + 1]). More...
 

Namespaces

namespace  comm
 

Enumerations

enum class  comm::Op { comm::SUM , comm::MIN , comm::MAX }
 

Functions

int comm::rank ()
 Rank of this process in the world communicator.
 
int comm::size ()
 Number of processes in the world communicator.
 
bool comm::is_root ()
 Whether this is rank 0, which does all logging.
 
void comm::barrier ()
 Block until all ranks arrive.
 
void comm::abort (int code)
 Ends every rank with the given exit code (MPI_Abort in parallel runs).
 
template<typename T >
void comm::allreduce (std::span< T > data, Op op)
 In-place all-reduce over all ranks of the values in data.
 
template<typename T >
T comm::allreduce (T value, Op op)
 
template<typename T , std::size_t N>
std::array< T, N > comm::allreduce (std::array< T, N > values, Op op)
 
template<typename T >
std::vector< std::vector< T > > comm::alltoallv (const std::vector< std::vector< T > > &send)
 Personalized all-to-all: send[r] goes to rank r; returns what each rank sent to this one, indexed by source rank.
 
template<typename T >
Received< T > comm::exchange (std::vector< std::vector< T > > &&send)
 Personalized all-to-all like alltoallv, for large setup-time messages: frees each send list once packed, and returns what it received in one buffer, in rank order.
 
template<typename T >
std::vector< T > comm::allgatherv (const std::vector< T > &local)
 Concatenation of every rank's local vector, in rank order.
 

Detailed Description

Process-level communication: MPI when built with Mallard_ENABLE_MPI, otherwise a single-rank stub with the same interface.

Author
Matthew Bonanni (mbona.nosp@m.nni0.nosp@m.01@gm.nosp@m.ail..nosp@m.com)
Version
0.3
Date
2026-10-02