12#ifndef DUMUX_COMMON_INITIALIZE_HH
13#define DUMUX_COMMON_INITIALIZE_HH
19#include <dune/common/parallel/mpihelper.hh>
22#include <oneapi/tbb/info.h>
23#include <oneapi/tbb/global_control.h>
31 static oneapi::tbb::global_control& instance(
int& argc,
char* argv[])
33 int maxNumThreads = oneapi::tbb::info::default_concurrency();
34 if (
const char* dumuxNumThreads = std::getenv(
"DUMUX_NUM_THREADS"))
35 maxNumThreads = std::max(1, std::stoi(std::string{ dumuxNumThreads }));
37 static oneapi::tbb::global_control global_limit(
38 oneapi::tbb::global_control::max_allowed_parallelism, maxNumThreads
57#include <Kokkos_Core.hpp>
65 static Kokkos::ScopeGuard& instance(
int& argc,
char* argv[])
67 Kokkos::InitArguments arguments;
68 if (
const char* dumuxNumThreads = std::getenv(
"DUMUX_NUM_THREADS"))
69 arguments.num_threads = std::max(1, std::stoi(std::string{ dumuxNumThreads }));
71 static Kokkos::ScopeGuard guard(arguments);
87 Dune::MPIHelper::instance(argc, argv);
91 Detail::TBBGlobalControl::instance(argc, argv);
95 if (
const char* dumuxNumThreads = std::getenv(
"DUMUX_NUM_THREADS"))
97 std::max(1, std::stoi(std::string{ dumuxNumThreads }))
103 Detail::KokkosScopeGuard::instance(argc, argv);
Distance implementation details.
Definition: cvfelocalresidual.hh:25
void initialize(int &argc, char *argv[])
Definition: initialize.hh:83