File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,8 +17,10 @@ thread_local bool Executor::amWorkerThread{false};
1717
1818unsigned int Executor::getEvalCores (const EvalSettings & evalSettings)
1919{
20+ /* Note: the default number of cores is currently limited to 32
21+ due to scalability bottlenecks. */
2022 return evalSettings.evalProfilerMode != EvalProfilerMode::disabled ? 1
21- : evalSettings.evalCores == 0UL ? Settings::getDefaultCores ()
23+ : evalSettings.evalCores == 0UL ? std::min ( 32U , Settings::getDefaultCores () )
2224 : evalSettings.evalCores ;
2325}
2426
@@ -32,8 +34,16 @@ Executor::Executor(const EvalSettings & evalSettings)
3234{
3335 debug (" executor using %d threads" , evalCores);
3436 auto state (state_.lock ());
37+ // FIXME: create worker threads on demand?
3538 for (size_t n = 0 ; n < evalCores; ++n)
36- createWorker (*state);
39+ try {
40+ createWorker (*state);
41+ } catch (boost::thread_resource_error & e) {
42+ if (n == 0 )
43+ throw Error (" could not create any evaluator worker threads: %s" , e.what ());
44+ warn (" could only create %d evaluator worker threads: %s" , n, e.what ());
45+ break ;
46+ }
3747}
3848
3949Executor::~Executor ()
You can’t perform that action at this time.
0 commit comments