12#if defined(HAVE_TPETRACORE_MPI)
13# include "Teuchos_DefaultMpiComm.hpp"
15# include "Teuchos_Comm.hpp"
21#if defined(HAVE_TPETRACORE_MPI)
24 (void) MPI_Initialized (&isInitialized);
38#if defined(HAVE_TPETRACORE_MPI)
41 (void) MPI_Finalized (&isFinalized);
47 return isFinalized != 0;
53#if defined(HAVE_TPETRACORE_MPI)
54 bool isMpiComm (
const Teuchos::Comm<int>& comm)
56 using mpi_comm_type = Teuchos::MpiComm<int>;
57 return dynamic_cast<const mpi_comm_type*
> (&comm) !=
nullptr;
60 bool isMpiComm (
const Teuchos::Comm<int>& )
66 int getRankHarmlessly (
const Teuchos::Comm<int>& comm)
68 if (mpiIsInitialized () && ! mpiIsFinalized () && isMpiComm (comm)) {
69 return comm.getRank ();
82 const Teuchos::Comm<int>* comm)
84 if (comm ==
nullptr || getRankHarmlessly (*comm) == 0) {
Declaration of Tpetra::Details::printOnce.
Nonmember function that computes a residual Computes R = B - A * X.
void printOnce(std::ostream &out, const std::string &s, const Teuchos::Comm< int > *comm)
Print on one process of the given communicator, or at least try to do so (if MPI is not initialized).
bool mpiIsInitialized()
Has MPI_Init been called (on this process)?
bool mpiIsFinalized()
Has MPI_Finalize been called (on this process)?
Namespace Tpetra contains the class and methods constituting the Tpetra library.
bool isInitialized()
Whether Tpetra is in an initialized state.