Intel Compiler fails to build mxnet
Description
Unable to build libmxnet from git. Facing at least 2 errors. Able to workaround just one of them
Environment info (Required)
----------Python Info---------- Version : 3.5.2 Compiler : GCC 5.4.0 20160609 Build : ('default', 'Nov 12 2018 13:43:14') Arch : ('64bit', 'ELF') ------------Pip Info----------- Version : 8.1.1 Directory : /usr/lib/python3/dist-packages/pip ----------MXNet Info----------- Version : 1.5.0 Directory : /home/stsukrov/workspace/mxnet/python/mxnet Hashtag not found. Not installed from pre-built package. ----------System Info---------- Platform : Linux-4.4.0-1074-aws-x86_64-with-Ubuntu-16.04-xenial system : Linux node : ip-172-31-1-212 release : 4.4.0-1074-aws version : #84-Ubuntu SMP Thu Dec 6 08:57:58 UTC 2018 ----------Hardware Info---------- machine : x86_64 processor : x86_64 Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 72 On-line CPU(s) list: 0-71 Thread(s) per core: 2 Core(s) per socket: 18 Socket(s): 2 NUMA node(s): 2 Vendor ID: GenuineIntel CPU family: 6 Model: 85 Model name: Intel(R) Xeon(R) Platinum 8124M CPU @ 3.00GHz Stepping: 4 CPU MHz: 3000.000 BogoMIPS: 6000.00 Hypervisor vendor: KVM Virtualization type: full L1d cache: 32K L1i cache: 32K L2 cache: 1024K L3 cache: 25344K NUMA node0 CPU(s): 0-17,36-53 NUMA node1 CPU(s): 18-35,54-71 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single kaiser fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f rdseed adx smap clflushopt clwb avx512cd xsaveopt xsavec xgetbv1 ida arat pku ----------Network Test---------- Setting timeout: 10 Timing for Conda: https://repo.continuum.io/pkgs/free/, DNS: 0.0155 sec, LOAD: 0.0708 sec. Timing for FashionMNIST: https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz, DNS: 0.0348 sec, LOAD: 0.2342 sec. Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0010 sec, LOAD: 0.3944 sec. Timing for Gluon Tutorial(en): http://gluon.mxnet.io, DNS: 0.0896 sec, LOAD: 0.7671 sec. Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0006 sec, LOAD: 0.9998 sec. Timing for Gluon Tutorial(cn): https://zh.gluon.ai, DNS: 0.2689 sec, LOAD: 1.0834 sec.
Build info (Required if built from source)
Compiler (gcc/clang/mingw/visual studio): icc version 19.0.1.144 (gcc version 5.4.0 compatibility)
MXNet commit hash: d684c59049970794e8f7365f58b03e13801b44a3
Build config: cmake -DUSE_CUDA=OFF -DCMAKE_C_COMPILER="/home/stsukrov/intel/bin/icc" -DCMAKE_CXX_COMPILER="/home/stsukrov/intel/bin/icpc" ..
Error Message:
/home/stsukrov/workspace/incubator-mxnet/src/operator/l2_normalization.cc(84): error: parallel loops with collapse must be perfectly nested
for (int shape0 = 0; shape0 < static_cast<int>(dshape[0]); shape0++) {
^
detected during:
instantiation of "void mxnet::op::L2NormalizationOpCPU<DType>::Forward(const mxnet::OpContext &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &, const std::vector<mxnet::OpReqType, std::allocator<mxnet::OpReqType>> &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &) [with DType=float]" at line 39
implicit generation of "mxnet::op::L2NormalizationOpCPU<DType>::~L2NormalizationOpCPU() [with DType=float]" at line 39
instantiation of class "mxnet::op::L2NormalizationOpCPU<DType> [with DType=float]" at line 39
instantiation of "mxnet::op::L2NormalizationOpCPU<DType>::L2NormalizationOpCPU(mxnet::op::L2NormalizationParam) [with DType=float]" at line 129
Error: the OpenMP "single" pragma must not be enclosed by the "for" pragma
detected during:
instantiation of "void mxnet::op::L2NormalizationOpCPU<DType>::Forward(const mxnet::OpContext &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &, const std::vector<mxnet::OpReqType, std::allocator<mxnet::OpReqType>> &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &) [with DType=float]" at line 39 of "/home/stsukrov/workspace/incubator-mxnet/src/operator/l2_normalization.cc"
implicit generation of "mxnet::op::L2NormalizationOpCPU<DType>::~L2NormalizationOpCPU() [with DType=float]" at line 39 of "/home/stsukrov/workspace/incubator-mxnet/src/operator/l2_normalization.cc"
instantiation of class "mxnet::op::L2NormalizationOpCPU<DType> [with DType=float]" at line 39 of "/home/stsukrov/workspace/incubator-mxnet/src/operator/l2_normalization.cc"
instantiation of "mxnet::op::L2NormalizationOpCPU<DType>::L2NormalizationOpCPU(mxnet::op::L2NormalizationParam) [with DType=float]" at line 129 of "/home/stsukrov/workspace/incubator-mxnet/src/operator/l2_normalization.cc"
/home/stsukrov/workspace/incubator-mxnet/src/operator/l2_normalization.cc(108): error: parallel loops with collapse must be perfectly nested
for (int shape0 = 0; shape0 < static_cast<int>(dshape[0]); shape0++) {
^
detected during:
instantiation of "void mxnet::op::L2NormalizationOpCPU<DType>::Forward(const mxnet::OpContext &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &, const std::vector<mxnet::OpReqType, std::allocator<mxnet::OpReqType>> &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &) [with DType=float]" at line 39
implicit generation of "mxnet::op::L2NormalizationOpCPU<DType>::~L2NormalizationOpCPU() [with DType=float]" at line 39
instantiation of class "mxnet::op::L2NormalizationOpCPU<DType> [with DType=float]" at line 39
instantiation of "mxnet::op::L2NormalizationOpCPU<DType>::L2NormalizationOpCPU(mxnet::op::L2NormalizationParam) [with DType=float]" at line 129
Error: the OpenMP "single" pragma must not be enclosed by the "for" pragma
detected during:
instantiation of "void mxnet::op::L2NormalizationOpCPU<DType>::Forward(const mxnet::OpContext &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &, const std::vector<mxnet::OpReqType, std::allocator<mxnet::OpReqType>> &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &, const std::vector<mxnet::TBlob, std::allocator<mxnet::TBlob>> &) [with DType=float]" at line 39 of "/home/stsukrov/workspace/incubator-mxnet/src/operator/l2_normalization.cc"
implicit generation of "mxnet::op::L2NormalizationOpCPU<DType>::~L2NormalizationOpCPU() [with DType=float]" at line 39 of "/home/stsukrov/workspace/incubator-mxnet/src/operator/l2_normalization.cc"
instantiation of class "mxnet::op::L2NormalizationOpCPU<DType> [with DType=float]" at line 39 of "/home/stsukrov/workspace/incubator-mxnet/src/operator/l2_normalization.cc"
instantiation of "mxnet::op::L2NormalizationOpCPU<DType>::L2NormalizationOpCPU(mxnet::op::L2NormalizationParam) [with DType=float]" at line 129 of "/home/stsukrov/workspace/incubator-mxnet/src/operator/l2_normalization.cc"
compilation aborted for /home/stsukrov/workspace/incubator-mxnet/src/operator/l2_normalization.cc (code 2)
CMakeFiles/mxnet_static.dir/build.make:1271: recipe for target 'CMakeFiles/mxnet_static.dir/src/operator/l2_normalization.cc.o' failed
make[2]: *** [CMakeFiles/mxnet_static.dir/src/operator/l2_normalization.cc.o] Error 2
Minimum reproducible example
(If you are using your own code, please provide a short script that reproduces the error. Otherwise, please provide link to the existing example.)
Steps to reproduce
(Paste the commands you ran that produced the error.)
- Get intel compiler
- cmake -DUSE_CUDA=OFF -DCMAKE_C_COMPILER="/home/stsukrov/intel/bin/icc" -DCMAKE_CXX_COMPILER="/home/stsukrov/intel/bin/icpc" ..
- make -j20
What have you tried to solve it?
- extract the temporary variables for for-loop boundaries - can build at least mxnet
- Unable to fix the test internal error
Hey, this is the MXNet Label Bot. Thank you for submitting the issue! I will try and suggest some labels so that the appropriate MXNet community members can help resolve it. Here are my recommended labels: Test
@mxnet-label-bot add [build, compiler error]
@TaoLv has successfully built the MXNet with ICC. We can provide the detail information later (maybe early of next week).
@pengzhao-intel I was able to fix the issue by extracting the for-loop boundaries.
Will appreciate if you can provide the instructions, since I'm facing an another internal error.
@stsukrov May I know which version of ICC you are working with? I'm using ICC19.
icc version 19.0.1.144
I had a simple integration here. But it's not rebased to master branch yet. Please let me know if it works for you.
@TaoLv
Really confused :)
Unable to find any documentation on --new_cilkfor I assume it's some kind of magic internal Intel flag.
l2_normalization.cc is compilable now. Confirming, that it partially fixes the issue - I'm able to build libmxnet.so.
It doesn't fix the second internal error:
icpc -DCUB_MKL=1 -DDMLC_USE_CXX11 -DDMLC_USE_CXX11=1 -DMSHADOW_IN_CXX11 -DMSHADOW_USE_CBLAS=1 -DMSHADOW_USE_CUDA=0 -DMSHADOW_USE_MKL=0 -DMSHADOW_USE_SSE=1 -DMXNET_USE_LAPACK=1 -DMXNET_USE_MKLDNN=1 -DMXNET_USE_NCCL=0 -DMXNET_USE_OPENCV=1 -DMXNET_USE_OPENMP=1 -DMXNET_USE_OPERATOR_TUNING=1 -DNDEBUG=1 -DUSE_JEMALLOC -DUSE_MKL=1 -I/home/stsukrov/workspace/incubator-mxnet/build/mklml/mklml_lnx_2019.0.1.20180928/include -I/home/stsukrov/workspace/incubator-mxnet/3rdparty/mkldnn/include -I/home/stsukrov/workspace/incubator-mxnet/include -I/home/stsukrov/workspace/incubator-mxnet/src -I/home/stsukrov/workspace/incubator-mxnet/3rdparty/mshadow -I/home/stsukrov/workspace/incubator-mxnet/3rdparty/cub -I/home/stsukrov/workspace/incubator-mxnet/3rdparty/tvm/nnvm/include -I/home/stsukrov/workspace/incubator-mxnet/3rdparty/tvm/include -I/home/stsukrov/workspace/incubator-mxnet/3rdparty/dmlc-core/include -I/home/stsukrov/workspace/incubator-mxnet/3rdparty/dlpack/include -I/home/stsukrov/workspace/incubator-mxnet/3rdparty/googletest/googletest/include -I/home/stsukrov/workspace/incubator-mxnet/tests/cpp/include -isystem /usr/include/opencv -Wall -Wno-unknown-pragmas -Wno-sign-compare -O3 -msse2 -std=c++11 -mf16c -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -qopenmp -std=c++0x -fPIE -o CMakeFiles/mxnet_unit_tests.dir/cpp/operator/batchnorm_test.cc.o -c /home/stsukrov/workspace/incubator-mxnet/tests/cpp/operator/batchnorm_test.cc -Qoption,cpp,--new_cilkfor
/home/stsukrov/workspace/incubator-mxnet/tests/cpp/include/./././test_util.h(225) (col. 5): internal error: 04010002_1506
compilation aborted for /home/stsukrov/workspace/incubator-mxnet/tests/cpp/operator/batchnorm_test.cc (code 4)
@stsukrov I think it's something new in recent version of ICC (since 2019) and not well documented. I will communicate with compiler team and let you know if there is any public available document for it.
Also thank you for pointing out the internal error. I didn't have a try on compiling cpp test with ICC. Will try to reproduce the error and get back to you later.
@stsukrov one more, do you mind providing some backgrounds and the goal of the compiler switching so that we can have a big picture and thinking about the final solution, such as how to deliver the patch in ICC?
@pengzhao-intel
We have just evaluated, if it's possible to compile mxnet with ICC. I assume it's still an issue, since we face 2 internal errors.
@stsukrov thanks for the information. I think it's not a big problem. Intel team can fix it :)
Sure. Looking forward
@pengzhao-intel @TaoLv Any feedback on the topic?
@stsukrov The two internal error are reproduced and tracked internally. Will let you know once they are got fixed. Probably we need patch release of the compiler but it needs time.
@TaoLv Thanks. Feel free to request any testing on the issue.