12 #if defined(HAVE_TPETRACORE_MPI)
13 #include "Teuchos_DefaultMpiComm.hpp"
15 #include "Teuchos_Comm.hpp"
16 #endif // defined(HAVE_TPETRACORE_MPI)
20 #if defined(HAVE_TPETRACORE_MPI)
23 (void)MPI_Initialized(&isInitialized);
28 return isInitialized != 0;
31 #endif // defined(HAVE_TPETRACORE_MPI)
35 #if defined(HAVE_TPETRACORE_MPI)
38 (void)MPI_Finalized(&isFinalized);
43 return isFinalized != 0;
46 #endif // defined(HAVE_TPETRACORE_MPI)
49 #if defined(HAVE_TPETRACORE_MPI)
50 bool isMpiComm(
const Teuchos::Comm<int>& comm) {
51 using mpi_comm_type = Teuchos::MpiComm<int>;
52 return dynamic_cast<const mpi_comm_type*
>(&comm) !=
nullptr;
55 bool isMpiComm(
const Teuchos::Comm<int>& ) {
58 #endif // defined(HAVE_TPETRACORE_MPI)
60 int getRankHarmlessly(
const Teuchos::Comm<int>& comm) {
62 return comm.getRank();
73 const Teuchos::Comm<int>* comm) {
74 if (comm ==
nullptr || getRankHarmlessly(*comm) == 0) {
bool isInitialized()
Whether Tpetra is in an initialized state.
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)...
Declaration of Tpetra::Details::printOnce.
bool mpiIsFinalized()
Has MPI_Finalize been called (on this process)?
bool mpiIsInitialized()
Has MPI_Init been called (on this process)?