Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
2421 Discussions

calling flowgraph operators()() through shared library


Does anyone know if this is possible?...

To create a FlowGraph whereby each function is a class loaded from a shared library: probably Boost::extension to maintain portability between Windows & Linux.

Just a little concerned about:

- calls to the operator() to run the flow graph function

- any performance penalties this may incur

Any ideas?



0 Kudos
1 Reply
Black Belt

Shared libraries per se should not be a problem (TBB comes as a shared library, and even treats the scalable allocator as a dynamically loadable library), but obviously you shouldn't look up a function by name from a dynamically loadable library on each invocation (shared_library::get() from Boost.Extension, or similar). If I can assume that "each function is a class loaded from a shared library" means that your tbb::function_node Body calls a function object from a dynamically loadable library, isn't the question now about the performance of boost::function after it has been assigned a value? There's obviously some run-time indirection going on there, strictly speaking, but you needn't worry about that here (as opposed maybe to calling a minimal function in a tight loop). Maybe it's even possible to load a subclass of an abstract Body (right?), and then you would know it's a straight virtual-function call (not necessarily cheaper than a boost::function call, but at least more familiar), but I would have to check that first.