Skip to content
Snippets Groups Projects
Commit 344c33fa authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

Environment variable BA_NTHREADS provides default number of threads

parent f4915a40
No related branches found
No related tags found
1 merge request!556Environment variable BA_NTHREADS provides default number of threads
Pipeline #52330 passed
......@@ -14,11 +14,21 @@
#include "Resample/Options/SimulationOptions.h"
#include "Base/Util/Assert.h"
#include <cstdlib>
#include <iostream>
#include <string>
#include <thread>
SimulationOptions::SimulationOptions()
: m_mc_integration(false), m_include_specular(false), m_use_avg_materials(false), m_mc_points(1)
{
if (const char* env_p = std::getenv("BA_NTHREADS")) {
std::cout << "Got number of threads from environment variable BA_NTHREADS = "
<< env_p << std::endl;
m_thread_info.n_threads = std::stoi(env_p);
if (m_thread_info.n_threads>0)
return;
}
m_thread_info.n_threads = getHardwareConcurrency();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment