mxnet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lv, Tao A" <>
Subject RE: [Discussion] Remove bundled llvm OpenMP
Date Thu, 22 Nov 2018 13:02:11 GMT
Thanks for the great summary, Anton. I'm curious that is there anybody builds mxnet successfully
with ICC/ICPC?

-----Original Message-----
From: Anton Chernov [] 
Sent: Thursday, November 22, 2018 8:36 PM
Subject: [Discussion] Remove bundled llvm OpenMP

Dear MXNet community,

I would like to drive attention to an important issue that is present in the MXNet CMake build:
usage of bundled llvm OpenMP library.

I have opened a PR to remove it:

The issue was closed, but I am strong in my oppinion that it's the right thing to do.

If you want to use OpenMP pragmas in your code for parallelization you would supply a special
flag to the compiler:

- Clang / -fopenmp

- GCC / -fopenmp

- Intel / [Q]openmp

- Visual Studio: /openmp (Enable OpenMP 2.0 Support)

Each of the compilers would enable the '#pragma omp' directive during C/C++ compilation and
arrange for automatic linking of the OpenMP runtime library supplied by each complier separately.

Thus, to use the advantages of an OpenMP implementation one has to compile the code with the
corresponding compiler.

Currently, in MXNet CMake build scripts a bundled version of llvm OpenMP is used ([1] and
[2]) to replace the OpenMP library supplied by the compiler.

I will quote here the README from the MKL-DNN (Intel(R) Math Kernel Library for Deep Neural

"Intel MKL-DNN uses OpenMP* for parallelism and requires an OpenMP runtime library to work.
As different OpenMP runtimes may not be binary compatible it's important to ensure that only
one OpenMP runtime is used throughout the application. Having more than one OpenMP runtime
initialized may lead to undefined behavior resulting in incorrect results or crashes." [3]


"Using GNU compiler with -fopenmp and -liomp5 options will link the application with both
Intel and GNU OpenMP runtime libraries. This will lead to undefined behavior of the application."

As can be seen from ldd for MXNet:

$ ldd build/tests/mxnet_unit_tests | grep omp => /.../mxnet/build/3rdparty/openmp/runtime/src/
(0x00007f697bc55000) => /usr/lib/x86_64-linux-gnu/


The only performance data related to OpenMP in MXNet I was able to find is

Which in my understanding is testing imact of different environment variables for the same
setup (using same bundled OpenMP library).

The libraries may differ in implementation and the Thread Affinity Interface [5] may have
significant impact on performance.

All compliers support it:




- Visual Studio / SetThreadAffinityMask


Failed OpenMP assertion when loading MXNet compiled with DEBUG=1 dependency (need REAL fix)

mxnet-mkl (v0.12.0) crash when using (conda-installed) numpy with MKL

Performance regression when OMP_NUM_THREADS environment variable is not set

Poor concat CPU performance on CUDA builds

I would appreciate hearing your thoughts.


View raw message