FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
runtime.hpp
1// FEAT3: Finite Element Analysis Toolbox, Version 3
2// Copyright (C) 2010 by Stefan Turek & the FEAT group
3// FEAT3 is released under the GNU General Public License version 3,
4// see the file 'copyright.txt' in the top level directory for details.
5
6#pragma once
7
8// includes, FEAT
10#ifdef FEAT_HAVE_CUDA
11 #include <kernel/util/cuda_util.hpp>
12#endif
13#ifdef FEAT_DEBUG_MODE
14 #include <assert.h>
15#endif
16
17namespace FEAT
18{
24 class Runtime
25 {
26 private:
28 static bool _initialized;
29
31 static bool _finalized;
32
33 public:
38 {
39 public:
48 explicit ScopeGuard(int& argc, char**& argv)
49 {
50 Runtime::initialize(argc, argv);
51 }
52
59 {
61 }
62 }; // class Runtime::Guard
63
72 {
73 public:
74 static bool sync_on;
75
76 public:
77 SyncGuard()
78 {
79 #ifdef FEAT_DEBUG_MODE
80 assert((sync_on) && "Already in SyncGuard scope!");
81 #endif
82
83 this->sync_on = false;
84 }
85
87 {
88 #ifdef FEAT_HAVE_CUDA
89 Util::cuda_force_synchronize();
90 #endif
91 this->sync_on = true;
92 }
93
94 static bool enable_synchronize()
95 {
96 return sync_on;
97 }
98
99 friend class Runtime;
100 };
101
114 static void initialize(int& argc, char**& argv);
115
126 [[noreturn]] static void abort(bool dump_call_stack = true);
127
147 static int finalize();
148
152 static void* get_cudss_handle();
153 }; // class Runtime
154} // namespace FEAT
FEAT Kernel base header.
Runtime scope guard class.
Definition: runtime.hpp:38
ScopeGuard(int &argc, char **&argv)
Runtime scope guard constructor.
Definition: runtime.hpp:48
~ScopeGuard()
Runtime scope guard destructor.
Definition: runtime.hpp:58
Runtime sync guard class.
Definition: runtime.hpp:72
FEAT Runtime management class.
Definition: runtime.hpp:25
static int finalize()
FEAT finalization.
Definition: runtime.cpp:445
static bool _finalized
signals, if finalize was called
Definition: runtime.hpp:31
static void * get_cudss_handle()
Returns the unique cuDSS third-party library handle.
Definition: runtime.cpp:488
static bool _initialized
signals, if initialize was called
Definition: runtime.hpp:28
static void initialize(int &argc, char **&argv)
FEAT initialization.
Definition: runtime.cpp:51
static void abort(bool dump_call_stack=true)
FEAT abortion.
Definition: runtime.cpp:413
FEAT namespace.
Definition: adjactor.hpp:12