docker run -it okapies/buildenv:linux-x64-gcc-4.9 /bin/bash (Dockerfile)# curl -LO https://github.com/intel/mkl-dnn/archive/v0.16.tar.gz
# tar xvf v0.16.tar.gz
# cd mkl-dnn-0.16
# cd scripts && ./prepare_mkl.sh && cd ..
# printenv | grep PATH
PATH=/usr/local/gcc-4.9.4/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
LD_LIBRARY_PATH=/usr/local/gcc-4.9.4/lib64:/usr/local/gcc-4.9.4/lib:/usr/local/lib64:/usr/local/lib
# mkdir -p build
# cd build
# cmake -DCMAKE_C_COMPILER=/usr/local/gcc-4.9.4/bin/gcc \
-DCMAKE_CXX_COMPILER=/usr/local/gcc-4.9.4/bin/g++ \
-DWITH_TEST=OFF \
-DWITH_EXAMPLE=OFF \
..
The OLD behavior for policy CMP0048 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
CMake Deprecation Warning at CMakeLists.txt:22 (cmake_policy):
The OLD behavior for policy CMP0054 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
-- The C compiler identification is GNU 4.9.4
-- The CXX compiler identification is GNU 4.9.4
-- Check for working C compiler: /usr/local/gcc-4.9.4/bin/gcc
-- Check for working C compiler: /usr/local/gcc-4.9.4/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/local/gcc-4.9.4/bin/g++
-- Check for working CXX compiler: /usr/local/gcc-4.9.4/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- CMAKE_BUILD_TYPE is unset, defaulting to Release
-- Detecting Intel(R) MKL: trying mklml_intel
-- Intel(R) MKL: include /root/mkl-dnn-0.16/external/mklml_lnx_2019.0.20180710/include
-- Intel(R) MKL: lib /root/mkl-dnn-0.16/external/mklml_lnx_2019.0.20180710/lib/libmklml_intel.so
-- Intel(R) MKL: OpenMP lib /root/mkl-dnn-0.16/external/mklml_lnx_2019.0.20180710/lib/libiomp5.so
-- Found OpenMP_C: -fopenmp (found version "4.0")
-- Found OpenMP_CXX: -fopenmp (found version "4.0")
-- Found OpenMP: TRUE (found version "4.0")
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- VTune profiling environment is unset
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /root/mkl-dnn-0.16/build
# make
Scanning dependencies of target mkldnn
[ 1%] Building CXX object src/CMakeFiles/mkldnn.dir/common/batch_normalization.cpp.o
<snip>
[100%] Linking CXX shared library libmkldnn.so
[100%] Built target mkldnn
# ldd src/libmkldnn.so
linux-vdso.so.1 => (0x00007ffd3fbc4000)
/root/mkl-dnn-0.16/external/mklml_lnx_2019.0.20180710/lib/libiomp5.so (0x00007f029a91d000)
libmklml_intel.so => /root/mkl-dnn-0.16/external/mklml_lnx_2019.0.20180710/lib/libmklml_intel.so (0x00007f0292d0b000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f0292b07000)
libstdc++.so.6 => /usr/local/gcc-4.9.4/lib64/libstdc++.so.6 (0x00007f02927ce000)
libm.so.6 => /lib64/libm.so.6 (0x00007f029254a000)
libgomp.so.1 => /usr/local/gcc-4.9.4/lib64/libgomp.so.1 (0x00007f0292334000)
libgcc_s.so.1 => /usr/local/gcc-4.9.4/lib64/libgcc_s.so.1 (0x00007f029211e000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f0291f01000)
libc.so.6 => /lib64/libc.so.6 (0x00007f0291b6d000)
/lib64/ld-linux-x86-64.so.2 (0x00007f029b51f000)
librt.so.1 => /lib64/librt.so.1 (0x00007f0291965000)
libmkldnn.so is linked with both libiomp5 and libgomp if there is libgomp in LD_LIBRARY_PATH. It might be a problem as described in this section.
Only libiomp5 is used if there it is.
I found that GOMP_* symbols exist in my build even if it is linked to libmklml_intel.so.
# readelf -sW src/libmkldnn.so | c++filt | grep GOMP
224: 0000000000000000 0 FUNC GLOBAL DEFAULT UND GOMP_parallel@VERSION (7)
420: 0000000000000000 0 FUNC GLOBAL DEFAULT UND GOMP_barrier@VERSION (7)
45611: 0000000000000000 0 FUNC GLOBAL DEFAULT UND GOMP_parallel@@VERSION
45807: 0000000000000000 0 FUNC GLOBAL DEFAULT UND GOMP_barrier@@VERSION
Thank you for the report. There indeed should be be a dependency on libgomp in that case.
Just was able to reproduce.
Seems like this is somehow related to cmake 3.12.1, not gcc. At least I wasn't able to reproduce the behavior with cmake 2.8 and 3.7, but was able with 3.12.1.
Also I don't see that LD_LIBRARY_PATH affects the resulting library -- it always depends on both gomp and libiomp5. Will be looking into that...
FYI, I slightly changed okapies/buildenv:linux-x64-gcc-4.9 docker image described in the comment. I added some configurations to gcc and bump cmake version to 3.12.2. Sorry for being late to tell you.