.. index:: pair: struct; gpr::linalg::MpiContext .. _doxid-structgpr_1_1linalg_1_1_mpi_context: struct gpr::linalg::MpiContext ============================== .. toctree:: :hidden: Overview ~~~~~~~~ .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include struct MpiContext { // fields int :target:`rank` {0}; int :target:`nprocs` {1}; :ref:`MpiCommType` :target:`comm` {:ref:`kMpiCommNull`}; // methods bool :ref:`is_distributed`() const; static MpiContext :ref:`local`(); }; .. _details-structgpr_1_1linalg_1_1_mpi_context: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Methods ------- .. index:: pair: function; is_distributed .. _doxid-structgpr_1_1linalg_1_1_mpi_context_1a4296d814f3d6ddeb5b510022b960a671: .. ref-code-block:: cpp :class: doxyrest-title-code-block 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. .. index:: pair: function; local .. _doxid-structgpr_1_1linalg_1_1_mpi_context_1adcf9b9067c9cefb48eb84d265fb1da28: .. ref-code-block:: cpp :class: doxyrest-title-code-block 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.