From 4692a246d5660815c4e673ca9343913c505d308a Mon Sep 17 00:00:00 2001 From: DannyPuhan Date: Thu, 6 Jun 2024 09:45:42 +0200 Subject: [PATCH] [feat] Set number of threads via env variable `OMP_NUM_THREADS`. --- src/run.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/run.cpp b/src/run.cpp index baf9d44..eb263f8 100644 --- a/src/run.cpp +++ b/src/run.cpp @@ -85,6 +85,11 @@ double run_bench(const bench_input &input, const std::string &output_file) { tug::Simulation sim(grid, boundary); + if (const char *out = std::getenv("OMP_NUM_THREADS")) { + int ompNumThreads = std::stoi(out, NULL); + sim.setNumberThreads(ompNumThreads); + } + sim.setTimestep(input.timestep); sim.setIterations(input.iterations);