-
For a C++ library that uses OpenVDB as a dependency what is your recommended way of limiting the total # of threads that OpenVDB / TBB can spawn. I need a runtime user defined way to limit the max number of threads. I'm not asking how to set the max # of threads for a given system .. that is already TBB's default. Whats the recommended strategy? I appreciate the help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You can use openvdb/openvdb_cmd/vdb_ax/main.cc Lines 782 to 786 in e7ec2a7 If you're using other libraries which also use tbb but only want to control tbb utilisation in VDB, unfortunately the only** way is to wrap each call in an arena, as you've mentioned. ** you could also use multiple namespaced versions of tbb but this is probably a bit much |
Beta Was this translation helpful? Give feedback.
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 thevdb_ax
binary:openvdb/openvdb_cmd/vdb_ax/main.cc
Lines 782 to 786 in e7ec2a7
If you're using other libraries which also use tbb but only