Skip to content

Limit max threads available to OpenVDB / TBB #1615

Answered by Idclip
kdmarrett asked this question in Q&A
Discussion options

You must be logged in to vote

You can use tbb/global_control to achieve this. Note though that this will affect all tbb execution in your application that links against the specified version from which the ::global_control symbol is called. Here's an example that we use in the vdb_ax binary:

std::unique_ptr<tbb::global_control> control;
if (opts.mThreads.get() > 0) {
axlog("[INFO] Initializing thread usage [" << opts.mThreads.get() << "]\n" << std::flush);
control.reset(new tbb::global_control(tbb::global_control::max_allowed_parallelism, opts.mThreads.get()));
}

If you're using other libraries which also use tbb but only

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kdmarrett
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants