struct gpr::linalg::MpiContext

Overview

#include <MpiContext.h>
 
struct MpiContext {
    // fields
 
    int rank {0};
    int nprocs {1};
    MpiCommType comm {kMpiCommNull};
 
    // methods
 
    bool is_distributed() const;
    static MpiContext local();
};

Detailed Documentation

Methods

bool is_distributed() const

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.

static MpiContext local()

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.