SOPT
Sparse OPTimisation
session.h
Go to the documentation of this file.
1 #ifndef SOPT_MPI_SESSION_H
2 #define SOPT_MPI_SESSION_H
3 
4 #include "sopt/config.h"
5 #include <memory>
6 
7 #ifdef SOPT_MPI
8 #include <mpi.h>
9 #endif
10 
11 namespace sopt::mpi {
12 #ifdef SOPT_MPI
13 namespace details {
14 struct initializer {
15  static void deleter(initializer *tag);
17  static std::weak_ptr<details::initializer> singleton;
18 };
19 } // namespace details
21 std::shared_ptr<details::initializer> init(int argc, const char **argv);
22 std::shared_ptr<details::initializer> session_singleton();
24 bool initialized();
26 bool finalized();
27 #else
28 inline void init(int argc, const char **argv) {}
29 inline bool initialized() { return false; };
30 #endif
31 } // namespace sopt::mpi
32 #endif /* ifndef SOPT_MPI_SESSION_H */
bool finalized()
Definition: session.cc:71
std::shared_ptr< details::initializer > session_singleton()
Definition: session.cc:50
std::shared_ptr< details::initializer > init(int argc, const char **argv)
Definition: session.cc:27
bool initialized()
Definition: session.cc:61