3 using namespace Compadre;
7 _num_threads(-1), _numa(-1), _device(-1), _ngpu(-1) {
11 bool preinitialized = Kokkos::is_initialized();
13 if (!preinitialized) {
14 Kokkos::initialize(narg, arg);
15 _called_initialize =
true;
20 retrievePreviouslyInstantiatedKokkosInitArguments();
22 if (print_status && preinitialized) {
23 printf(
"Kokkos already initialized.");
51 _num_threads(num_threads), _numa(numa), _device(device), _ngpu(ngpu) {
67 printf(
"KOKKOS attempted initialization using settings:\n");
70 printf(
"KOKKOS recalculated and initiatized using settings:\n");
79 printf(
"Kokkos already initialized.");
82 }
else if (print_status) {
83 printf(
"Kokkos failed to initialize.");
89 Kokkos::InitArguments args;
91 args.num_numa =
_numa;
98 #ifdef COMPADRE_USE_CUDA
109 #ifdef KOKKOS_ENABLE_THREADS
112 _num_threads = Kokkos::HostSpace::execution_space::concurrency();
114 #ifdef KOKKOS_ENABLE_OPENMP
117 _num_threads = Kokkos::HostSpace::execution_space::concurrency();
129 bool preinitialized = Kokkos::is_initialized();
132 if (preinitialized) {
137 Kokkos::initialize(our_args);
139 }
catch (
const std::exception& e) {
140 std::cout << e.what() << std::endl;
163 #ifdef COMPADRE_USE_CUDA
int getNumberOfThreads() const
Kokkos::InitArguments createInitArguments() const
void retrievePreviouslyInstantiatedKokkosInitArguments()
int finalize(bool hard_finalize=false)