TIMPI
Loading...
Searching...
No Matches
timpi_init.h
Go to the documentation of this file.
1// The TIMPI Message-Passing Parallelism Library.
2// Copyright (C) 2002-2025 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3
4// This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation; either
7// version 2.1 of the License, or (at your option) any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// Lesser General Public License for more details.
13
14// You should have received a copy of the GNU Lesser General Public
15// License along with this library; if not, write to the Free Software
16// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18
19
20#ifndef TIMPI_INIT_H
21#define TIMPI_INIT_H
22
23
24// Local includes
25#include "timpi/timpi_config.h"
26
27#include "timpi/semipermanent.h"
28
29// C/C++ includes
30
31#ifdef TIMPI_HAVE_MPI
33# include <mpi.h>
35#endif // #ifdef TIMPI_HAVE_MPI
36
37#include <memory>
38
39namespace TIMPI
40{
41
42// Forward declarations
43 class Communicator;
44
58{
59public:
60#ifdef TIMPI_HAVE_MPI
78 TIMPIInit(int argc, const char * const * argv,
80 bool handle_mpi_errors=false,
82#else
83 TIMPIInit(int argc, const char * const * argv,
85 bool handle_mpi_errors=false);
86#endif
87
92 virtual ~TIMPIInit();
93
100 const Communicator & comm() const { return *_comm; }
101
102 Communicator & comm() { return *_comm; }
103
104private:
105 std::unique_ptr<Communicator> _comm;
106
107 // unique_ptr so we can free it *before* we MPI_Finalize
108 std::unique_ptr<SemiPermanent::Ref> _ref;
109
110#ifdef TIMPI_HAVE_MPI
112
115#endif
116};
117
118
119} // namespace TIMPI
120
121#endif // TIMPI_INIT_H
Encapsulates the MPI_Comm object.
The TIMPIInit class, when constructed, initializes any dependent libraries (e.g.
Definition timpi_init.h:58
MPI_Errhandler my_errhandler
Definition timpi_init.h:113
std::unique_ptr< SemiPermanent::Ref > _ref
Definition timpi_init.h:108
Communicator & comm()
Definition timpi_init.h:102
virtual ~TIMPIInit()
Destructor.
Definition timpi_init.C:136
const Communicator & comm() const
Returns the Communicator created by this object, which will be a compatibility shim if MPI is not ena...
Definition timpi_init.h:100
std::unique_ptr< Communicator > _comm
Definition timpi_init.h:105
Tnew cast_int(Told oldvar)