Skip to content

Commit

Permalink
user-defined thread count precedence
Browse files Browse the repository at this point in the history
Ensure that user-defined thread count takes precedence over getNumberOfLogicalThreads() (#2642)
  • Loading branch information
dopitz committed Oct 11, 2023
1 parent b5eed25 commit fff2e0f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions common/tasking/taskschedulerinternal.cpp
Expand Up @@ -150,7 +150,8 @@ namespace embree
{
Lock<MutexSys> lock(g_mutex);
assert(newNumThreads);
newNumThreads = min(newNumThreads, (size_t) getNumberOfLogicalThreads());
if (newNumThreads == std::numeric_limits<size_t>::max())
newNumThreads = (size_t) getNumberOfLogicalThreads();

numThreads = newNumThreads;
if (!startThreads && !running) return;
Expand Down Expand Up @@ -230,7 +231,8 @@ namespace embree
TaskScheduler::TaskScheduler()
: threadCounter(0), anyTasksRunning(0), hasRootTask(false)
{
threadLocal.resize(2*getNumberOfLogicalThreads()); // FIXME: this has to be 2x as in the compatibility join mode with rtcCommitScene the worker threads also join. When disallowing rtcCommitScene to join a build we can remove the 2x.
assert(threadPool);
threadLocal.resize(2 * TaskScheduler::threadCount()); // FIXME: this has to be 2x as in the compatibility join mode with rtcCommitScene the worker threads also join. When disallowing rtcCommitScene to join a build we can remove the 2x.
for (size_t i=0; i<threadLocal.size(); i++)
threadLocal[i].store(nullptr);
}
Expand Down

0 comments on commit fff2e0f

Please sign in to comment.