Compadre
1.5.5
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Compadre_KokkosParser.cpp
Go to the documentation of this file.
1
#include "
Compadre_KokkosParser.hpp
"
2
3
using namespace
Compadre
;
4
5
// for InitArguments, pass them directly in to Kokkos
6
KokkosParser::KokkosParser
(
KokkosInitArguments
args,
bool
print_status) {
7
this->
ksg
= !Kokkos::is_initialized()
8
#ifdef COMPADRE_KOKKOS_GREATEREQUAL_3_7
9
&& !Kokkos::is_finalized()
10
#endif
11
?
12
new
Kokkos::ScopeGuard(args) :
nullptr
;
13
if
(print_status) this->
status
();
14
}
15
16
// for command line arguments, pass them directly in to Kokkos
17
KokkosParser::KokkosParser
(
int
narg,
char
* args[],
bool
print_status) {
18
this->
ksg
= !Kokkos::is_initialized()
19
#ifdef COMPADRE_KOKKOS_GREATEREQUAL_3_7
20
&& !Kokkos::is_finalized()
21
#endif
22
?
23
new
Kokkos::ScopeGuard(narg, args) :
nullptr
;
24
if
(print_status) this->
status
();
25
}
26
27
KokkosParser::KokkosParser
(std::vector<std::string> stdvec_args,
bool
print_status) {
28
std::vector<char*> char_args;
29
for
(
const
auto
& arg : stdvec_args) {
30
char_args.push_back((
char
*)arg.data());
31
}
32
char_args.push_back(
nullptr
);
33
int
narg = (int)stdvec_args.size();
34
35
this->
ksg
= !Kokkos::is_initialized()
36
#ifdef COMPADRE_KOKKOS_GREATEREQUAL_3_7
37
&& !Kokkos::is_finalized()
38
#endif
39
?
40
new
Kokkos::ScopeGuard(narg, char_args.data()) :
nullptr
;
41
if
(print_status) this->
status
();
42
}
43
44
KokkosParser::KokkosParser
(
bool
print_status) :
KokkosParser
(
KokkosInitArguments
(), print_status) {}
45
46
std::string
KokkosParser::status
() {
47
std::stringstream stream;
48
Kokkos::print_configuration(stream,
true
);
49
std::string
status
= stream.str();
50
return
status
;
51
}
Compadre_KokkosParser.hpp
KokkosInitArguments
Kokkos::InitArguments KokkosInitArguments
Definition
Compadre_Typedefs.hpp:122
Compadre::KokkosParser::ksg
Kokkos::ScopeGuard * ksg
Definition
Compadre_KokkosParser.hpp:20
Compadre::KokkosParser::status
static std::string status()
Definition
Compadre_KokkosParser.cpp:46
Compadre::KokkosParser::KokkosParser
KokkosParser()
Compadre
Definition
Compadre_ApplyTargetEvaluations.hpp:5
Generated by
1.17.0