Teuchos - Trilinos Tools Package Version of the Day
Loading...
Searching...
No Matches
Teuchos_GlobalMPISession.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Teuchos: Common Tools Package
4//
5// Copyright 2004 NTESS and the Teuchos contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef TEUCHOS_GLOBAL_MPI_SESSION_HPP
11#define TEUCHOS_GLOBAL_MPI_SESSION_HPP
12
17
18#include "TeuchosCore_ConfigDefs.hpp"
19
20#include "Teuchos_ArrayView.hpp"
21
22
23namespace Teuchos {
24
34//
81class TEUCHOSCORE_LIB_DLL_EXPORT GlobalMPISession
82{
83public:
84
86
87
130 GlobalMPISession( int* argc, char*** argv, std::ostream *out = &std::cout );
131
134
136
138
139
144 static void abort();
145
147
148
156 static bool mpiIsInitialized();
157
163 static bool mpiIsFinalized();
164
175 static int getRank();
176
187 static int getNProc();
188
197 static void barrier();
198
215 static int sum(int localVal);
216
232 static void allGather(int localVal, const ArrayView<int> &allVals);
233
234#ifdef HAVE_TEUCHOSCORE_KOKKOS
242 static std::vector<std::string> getArgv ();
243#endif // HAVE_TEUCHOSCORE_KOKKOS
245
246private:
247
248 static bool haveMPIState_;
249 static bool mpiIsFinalized_;
250 static int rank_;
251 static int nProc_;
252#ifdef HAVE_TEUCHOSCORE_KOKKOS
260 static std::vector<std::string> argvCopy_;
261#endif // HAVE_TEUCHOSCORE_KOKKOS
262
263 static void initialize( std::ostream *out );
264
265 static void justInTimeInitialize();
266
267};
268
269} // namespace Teuchos
270
271#endif // TEUCHOS_GLOBAL_MPI_SESSION_HPP
Nonowning array view.
static int sum(int localVal)
Sum a set of integers across processes.
static void abort()
abort the program
static void barrier()
Call MPI_Barrier() on MPI_COMM_WORLD.
static int getRank()
The rank of the calling process in MPI_COMM_WORLD.
GlobalMPISession(int *argc, char ***argv, std::ostream *out=&std::cout)
Calls MPI_Init() if MPI is enabled.
static int getNProc()
The number of processes in MPI_COMM_WORLD.
static bool mpiIsInitialized()
Return whether MPI was initialized.
static bool mpiIsFinalized()
Return whether MPI was already finalized.
static void allGather(int localVal, const ArrayView< int > &allVals)
Global all-to-all of a set of integers across processes.
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...