uxlfoundation/oneTBB

Integrate oneTBB in my project

Closed this issue · 4 comments

I have added these in my CMakeList.txt:
find_package(TBB REQUIRED)
list(APPEND MNN_DEPENDS TBB::tbb)

and i write these in my code:
auto range_ = oneapi::tbb::blocked_range<std::size_t>(0, mTotalSize, 100); oneapi::tbb::parallel_for(range_, [&](const tbb::blocked_range<std::size_t>& range) { for (auto it = range.begin(); it != range.end(); ++it) { int j = 9; } });
then compile error like:
Undefined symbol: tbb::detail::r1::deallocate(tbb::detail::d1::small_object_pool&, void*, unsigned long, tbb::detail::d1::execution_data const&)
But if i just write :
auto range_ = oneapi::tbb::blocked_range<std::size_t>(0, mTotalSize, 100);
Then compilation succeed.
Like that error occured when i write "parallel_for"

@v0jiuqi what does list(APPEND MNN_DEPENDS TBB::tbb) do exactly? It seems like you do not link your application against oneTBB using target_link_libraries(<your_target> ... TBB::tbb)

i write this : target_link_libraries(xxx.out ${MNN_DEPS} ${EXTRA_LIBS})

Could you please show how the log looks like with VERBOSE=1 make command?

Thank you. I placed these two lines of code in the wrong position. Now i have fixed the bug. 👍