/usr/include/trilinos/Teuchos_GlobalMPISession.hpp is in libtrilinos-dev 10.4.0.dfsg-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | // @HEADER
// ***********************************************************************
//
// Teuchos: Common Tools Package
// Copyright (2004) Sandia Corporation
//
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
// license for use of this work by or on behalf of the U.S. Government.
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
// Questions? Contact Michael A. Heroux (maherou@sandia.gov)
//
// ***********************************************************************
// @HEADER
#ifndef TEUCHOS_GLOBAL_MPI_SESSION_HPP
#define TEUCHOS_GLOBAL_MPI_SESSION_HPP
/*! \file Teuchos_MPISession.hpp
\brief A MPI utilities class, providing methods for initializing,
finalizing, and querying the global MPI session
*/
#include "Teuchos_ConfigDefs.hpp"
#ifdef HAVE_MPI
#include "mpi.h"
#endif
namespace Teuchos {
/** \brief This class provides methods for initializing, finalizing, and
* querying the global MPI session.
*
* This class is primarilly designed to insulate basic <tt>main()</tt>
* program type of code from having to know if MPI is enabled or not.
*
* ToDo: Give examples!
*/
class TEUCHOS_LIB_DLL_EXPORT GlobalMPISession
{
public:
//! @name Public constructor and destructor
//@{
/** \brief Calls <tt>MPI_Init()</tt> if MPI is enabled.
*
* \param argc [in] Argment passed into <tt>main(argc,argv)</tt>
* \param argv [in] Argment passed into <tt>main(argc,argv)</tt>
* \param out [in] If <tt>out!=NULL</tt>, then a small message on each
* processor will be printed to this stream. The default is <tt>&std::cout</tt>.
*
* If the option <tt>--teuchos-suppress-startup-banner</tt> is found, the
* this option will be removed from <tt>argv[]</tt> before being passed to
* <tt>MPI_Init(...)</tt> and the startup output message to <tt>*out</tt>
* will be suppressed.
*
* <b>Warning!</b> This constructor can only be called once per
* executable or an error is printed to <tt>*out</tt> and an std::exception will
* be thrown!
*/
GlobalMPISession( int* argc, char*** argv, std::ostream *out = &std::cout );
/** \brief Calls <tt>MPI_Finalize()</tt> if MPI is enabled.
*/
~GlobalMPISession();
//@}
//! @name Static functions
//@{
/** \breif Return if MPI is initialized or not. */
static bool mpiIsInitialized();
/** \breif Return if MPI has already been finalized. */
static bool mpiIsFinalized();
/** \brief Returns the process rank relative to <tt>MPI_COMM_WORLD</tt>
*
* Returns <tt>0</tt> if MPI is not enabled.
*
* Note, this function can be called even if the above constructor was never
* called so it is safe to use no matter how <tt>MPI_Init()</tt> got called
* (but it must have been called somewhere).
*/
static int getRank();
/** \brief Returns the number of processors relative to
* <tt>MPI_COMM_WORLD</tt>
*
* Returns <tt>1</tt> if MPI is not enabled.
*
* Note, this function can be called even if the above constructor was never
* called so it is safe to use no matter how <tt>MPI_Init()</tt> got called
* (but it must have been called somewhere).
*/
static int getNProc();
//@}
private:
static bool haveMPIState_;
static bool mpiIsFinalized_;
static int rank_;
static int nProc_;
static void initialize( std::ostream *out );
};
} // namespace Teuchos
#endif // TEUCHOS_GLOBAL_MPI_SESSION_HPP
|