Loading...
Searching...
No Matches
gpr::linalg::MpiContext Struct Reference

#include <gpr/linalg/MpiContext.h>

Public Member Functions

bool is_distributed () const noexcept

Static Public Member Functions

static MpiContext local () noexcept

Public Attributes

int rank {0}
int nprocs {1}
MpiCommType comm {kMpiCommNull}

Detailed Description

Definition at line 59 of file MpiContext.h.

Member Function Documentation

◆ is_distributed()

bool gpr::linalg::MpiContext::is_distributed ( ) const
inlinenodiscardnoexcept

True iff the context spans more than one rank. Callers gate collective code paths on this rather than spelling nprocs > 1 inline so the policy lives next to the data it depends on.

Definition at line 67 of file MpiContext.h.

68 {
69 return nprocs > 1;
70 }

◆ local()

MpiContext gpr::linalg::MpiContext::local ( )
inlinestaticnodiscardnoexcept

Single-process context. Always available, regardless of build flavour. Returned communicator is MPI_COMM_NULL (or the int placeholder) because no collective is dispatched on the local path.

Definition at line 75 of file MpiContext.h.

76 {
77 return MpiContext{0, 1, kMpiCommNull};
78 }
constexpr MpiCommType kMpiCommNull
Definition MpiContext.h:56

Member Data Documentation

◆ comm

MpiCommType gpr::linalg::MpiContext::comm {kMpiCommNull}

Definition at line 62 of file MpiContext.h.

◆ nprocs

int gpr::linalg::MpiContext::nprocs {1}

Definition at line 61 of file MpiContext.h.

61{1};

◆ rank

int gpr::linalg::MpiContext::rank {0}

Definition at line 60 of file MpiContext.h.

60{0};

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