Tpetra parallel linear algebra Version of the Day
Loading...
Searching...
No Matches
Tpetra_Details_mpiIsInitialized.cpp
1// @HEADER
2// *****************************************************************************
3// Tpetra: Templated Linear Algebra Services Package
4//
5// Copyright 2008 NTESS and the Tpetra contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#include "Tpetra_Details_mpiIsInitialized.hpp"
11#ifdef HAVE_TPETRACORE_MPI
12# include "mpi.h"
13# include <iostream>
14#endif // HAVE_TPETRACORE_MPI
15
16namespace Tpetra {
17 namespace Details {
18
20 {
21#ifdef HAVE_TPETRACORE_MPI
22 int isInitialized = 0;
23 const int errCode = MPI_Initialized (&isInitialized);
24 // If the call failed, then assume MPI wasn't implemented
25 // correctly and return false.
26 return errCode == MPI_SUCCESS && (isInitialized != 0);
27#else
28 return false; // Tpetra was not built with MPI support
29#endif // HAVE_TPETRACORE_MPI
30 }
31
33 {
34#ifdef HAVE_TPETRACORE_MPI
35 int isFinalized = 0;
36 const int errCode = MPI_Finalized (&isFinalized);
37 // If the call failed, then assume MPI wasn't implemented
38 // correctly and return false.
39 return errCode == MPI_SUCCESS && (isFinalized != 0);
40#else
41 return false; // Tpetra was not built with MPI support
42#endif // HAVE_TPETRACORE_MPI
43 }
44
45 } // namespace Details
46} // namespace Tpetra
Nonmember function that computes a residual Computes R = B - A * X.
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.