[MXNet Build] CMake with MKL/OpenBLAS Issues


I am trying to build MXNet using CMake. But both MKL and OpenBLAS fail during cmake configuration or ninja building.

For MKL, the command is:
-> % cmake -GNinja -DUSE_CUDA=OFF -DBLAS=mkl' ../
CMake reports “Could NOT find MKL” error. But I found that the Intel® MKL has been detected:
-- Intel(R) MKL: $(MXNET_ROOT)/build/mklml/mklml_lnx_2019.0.3.20190220/include
-- Intel(R) MKL: $(MXNET_ROOT)/build/mklml/mklml_lnx_2019.0.3.20190220/lib/libmklml_intel.so

I think this issue is related to:
Cmake : could not find mkl (missing MKLDNN_LIBRARY)
which seems has not been solved yet.

Actually, I also have problem just using make:
-> % make USE_BLAS=mkl USE_MKLDNN=1
according to Build/Install MXNet with MKL-DNN. But there is an error from mkl-dnn:
error: array subscript is above array bounds [-Werror=array-bounds]
p.nodes[j-1] = p.nodes[j]

Then I tried OpenBLAS which has been installed in $(OPENBLAS_HOME).
CMake passed. And all the compilation seems OK. But in the link stage there is an error:
ld: cannot find -lopencv_dep_cudart
Since I’ve turned off the USE_CUDA switch, I don’t know why it needs this library and how to link it.

The make flow with OpenBLAS works well.