Build Failed with ONEDNN_CPU_RUNTIME=TBB
Summary
I'm encountering a build error when configuring oneDNN with the ONEDNN_CPU_RUNTIME=TBB option.
Environment
- CPU make and model (try
lscpu; if yourlscpudoes not list CPU flags, try runningcat /proc/cpuinfo | grep flags | sort -u): Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz - OS version (
uname -a): Linux ip-172-32-15-83 6.5.0-1023-aws - Compiler version (
gcc --version): 12.3.0 - CMake version (
cmake --version): 3.22.1 - CMake output log:
deepesh@ip-xxx-xx-xx-xx:~/pull_request/oneDNN/build$ cmake -DONEDNN_CPU_RUNTIME=TBB ..
-- CMAKE_BUILD_TYPE is unset, defaulting to Release
-- The C compiler identification is GNU 12.3.0
-- The CXX compiler identification is GNU 12.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- DNNL_TARGET_ARCH: X64
-- DNNL compat: set DNNL_CPU_RUNTIME to ONEDNN_CPU_RUNTIME with value
TBB-- DNNL_LIBRARY_NAME: dnnl -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE -- Found OpenMP_C: -fopenmp (found version "4.5") -- Found OpenMP_CXX: -fopenmp (found version "4.5") -- Found OpenMP: TRUE (found version "4.5") -- TBB: /usr -- Found Doxygen: /usr/bin/doxygen (found version "1.9.1") found components: doxygen dot -- Could NOT find Doxyrest (missing: DOXYREST_EXECUTABLE) -- Found PythonInterp: /usr/bin/python (found suitable version "3.10.12", minimum required is "2.7") -- Could NOT find Sphinx (missing: SPHINX_EXECUTABLE) -- Found Git: /usr/bin/git (found version "2.34.1") -- Enabled testing coverage: CI -- Enabled workload: TRAINING -- Enabled primitives: ALL -- Enabled primitive CPU ISA: ALL -- Enabled primitive GPU ISA: ALL -- Enabled GeMM kernels ISA: ALL -- Primitive cache is enabled -- The ASM compiler identification is GNU -- Found assembler: /usr/bin/cc -- Graph component is enabled -- Graph compiler backend is disabled. -- Configuring done -- Generating done -- Build files have been written to: /home/deepesh/pull_request/oneDNN/build - git hash (
git log -1 --format=%H): 7629a82f708b50c954688534cd41244060b9ccfa
Steps to reproduce
git clone https://github.com/oneapi-src/oneDNN.git cd oneDNN mkdir build cd build cmake -DONEDNN_CPU_RUNTIME=TBB .. make -j
Observed behavior
The build fails with errors related to TBB. Here are the relevant parts of the error log:
Consolidate compiler generated dependencies of target dnnl_graph_utils
[ 1%] Built target dnnl_graph_utils
Consolidate compiler generated dependencies of target dnnl_common
[ 6%] Built target dnnl_common
Consolidate compiler generated dependencies of target dnnl_cpu
[ 15%] Built target dnnl_cpu
Consolidate compiler generated dependencies of target dnnl_cpu_x64
[ 36%] Built target dnnl_cpu_x64
Consolidate compiler generated dependencies of target dnnl_graph_interface
[ 37%] Built target dnnl_graph_interface
Consolidate compiler generated dependencies of target dnnl_graph_backend_fake
[ 37%] Built target dnnl_graph_backend_fake
Consolidate compiler generated dependencies of target dnnl_graph_backend_dnnl
[ 43%] Built target dnnl_graph_backend_dnnl
[ 43%] Built target dnnl
Consolidate compiler generated dependencies of target bnorm-u8-via-binary-postops-cpp
[ 43%] Linking CXX executable bnorm-u8-via-binary-postops-cpp
/usr/bin/ld: ../src/libdnnl.so.3.6: undefined reference to tbb::detail::r1::spawn(tbb::detail::d1::task&, tbb::detail::d1::task_group_context&)'
/usr/bin/ld: ../src/libdnnl.so.3.6: undefined reference to tbb::detail::r1::allocate(tbb::detail::d1::small_object_pool*&, unsigned long)'
/usr/bin/ld: ../src/libdnnl.so.3.6: undefined reference to tbb::detail::r1::deallocate(tbb::detail::d1::small_object_pool&, void*, unsigned long, tbb::detail::d1::execution_data const&)'
/usr/bin/ld: ../src/libdnnl.so.3.6: undefined reference to tbb::detail::r1::spawn(tbb::detail::d1::task&, tbb::detail::d1::task_group_context&, unsigned short)'
/usr/bin/ld: ../src/libdnnl.so.3.6: undefined reference to tbb::detail::r1::destroy(tbb::detail::d1::task_group_context&)'
/usr/bin/ld: ../src/libdnnl.so.3.6: undefined reference to tbb::detail::r1::allocate(tbb::detail::d1::small_object_pool*&, unsigned long, tbb::detail::d1::execution_data const&)'
/usr/bin/ld: ../src/libdnnl.so.3.6: undefined reference to tbb::detail::r1::execute_and_wait(tbb::detail::d1::task&, tbb::detail::d1::task_group_context&, tbb::detail::d1::wait_context&, tbb::detail::d1::task_group_context&)'
/usr/bin/ld: ../src/libdnnl.so.3.6: undefined reference to tbb::detail::r1::initialize(tbb::detail::d1::task_group_context&)'
/usr/bin/ld: ../src/libdnnl.so.3.6: undefined reference to tbb::detail::r1::execution_slot(tbb::detail::d1::execution_data const*)'
/usr/bin/ld: ../src/libdnnl.so.3.6: undefined reference to tbb::detail::r1::max_concurrency(tbb::detail::d1::task_arena_base const*)'
/usr/bin/ld: ../src/libdnnl.so.3.6: undefined reference to `tbb::detail::r1::notify_waiters(unsigned long)'
collect2: error: ld returned 1 exit status
make[2]: *** [examples/CMakeFiles/bnorm-u8-via-binary-postops-cpp.dir/build.make:99: examples/bnorm-u8-via-binary-postops-cpp] Error 1
make[1]: *** [CMakeFiles/Makefile2:1062: examples/CMakeFiles/bnorm-u8-via-binary-postops-cpp.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
Expected behavior
The build process should complete without errors when ONEDNN_CPU_RUNTIME=TBB is specified.
Hi @deepeshfujitsu, using latest oneTBB [v2021.13.1], I was able to build successfully with no build errors linux with Intel(R) Xeon(R) Platinum 8480+.
From your cmake log, seems like tbb is installed under /usr, can you verify this is indeed the correct path to your oneTBB installation? Can you also please verify the version of TBB you have installed on your machine?
@yehudaorel, this build environment uses Linux native TBB package. Looks like TBB.cmake gets confused by the package layout or the package is old.
Fixed by 3c8060e04d36971e42d4cc38bd7e66b9d47aaf0c.