Summary of problems encountered in mxnet compilation and installation under python (1)

Let me first talk about why compile and install

Encountered Illegal instruction (core dumped) through pip install mxnet installation

After some searching, it turned out that the server cpu instruction set sse does not support, mxnet pip installation support code set is avx,

View command: cat /proc/cpuinfo
flags        : fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology pni cx16 x2apic hypervisor lahf_lm kaiser

Finally made up my mind to compile and install. Since the compilation and installation were not as smooth as expected, I summarized the problems encountered in order to help students who encountered such problems like me.

Summary of problems encountered in compiling and installing mxnet 1.5.1

【Problem Description】


/bin/sh: 1: cmake: not found
mkldnn.mk:48: recipe for target '/home/***/mxnet/3rdparty/mkldnn/build/install/lib/libdnnl.a' failed
make: *** [/home/***/mxnet/3rdparty/mkldnn/build/install/lib/libdnnl.a] Error 127
make: *** Waiting for unfinished jobs....
make[1]: Entering directory '/home/***/mxnet/3rdparty/dmlc-core'
make[1]: 'libdmlc.a' is up to date.
make[1]: Leaving directory '/home/***/mxnet/3rdparty/dmlc-core'

Found that cmake is not installed, 

sudo apt-get install cmake

【Problem Description】

/build/install/lib/libdnnl.a /home/***/mxnet/3rdparty/dmlc-core/libdmlc.a /home/***/mxnet/3rdparty/tvm/nnvm/lib/libnnvm.a -pthread -ldl -lm -lcblas -fopenmp -lrt  -lopencv_highgui -lopencv_imgproc -lopencv_core -llapack 
a - build/src/executor/eliminate_common_expr_pass.o
a - build/src/executor/graph_executor.o
a - build/src/executor/infer_graph_attr_pass.o
a - build/src/executor/attach_op_execs_pass.o
a - build/src/executor/attach_op_resource_pass.o
a - build/src/kvstore/gradient_compression.o
a - build/src/kvstore/kvstore_utils.o
a - build/src/kvstore/kvstore.o
a - build/src/resource.o
a - build/src/base.o
a - build/src/libinfo.o
a - build/src/initialize.o
/tmp/ccWjRTZm.o: In function `main':
im2rec.cc:(.text.startup+0x2994): undefined reference to `cv::imencode(std::string const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > const&)'
collect2: error: ld returned 1 exit status
Makefile:643: recipe for target 'bin/im2rec' failed
make: *** [bin/im2rec] Error 1

After inspection, it was found that:

The imencode method in tool/im2rec.cc passes four parameters, while the imencode interface in libopencv-dev passes five parameters, and then checked the version of g++ and gcc is 4.9, so I upgraded the version to 5, and it will be smooth compiled.

【Problem Description】

creating 'dist/mxnet-1.5.1-py2.7.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing mxnet-1.5.1-py2.7.egg
creating /usr/local/lib/pythonpy2.7/dist-packages/mxnet-1.6.0-pypy2.7.egg
Extracting mxnet-1.5.1-pypy2.7.egg to /usr/local/lib/pythonpy2.7/dist-packages
Adding mxnet 1.5.1 to easy-install.pth file

发现安装的mxnet是python2.7的版本,这怎么能行呢?于是乎想一定是操作系统自带的python编译的,反正其他环境已经编译好了,只是在python setup.py install 时,python 的版本不对, 于是乎,把环境切到python3.6.4, 找到mxnet/python/ 执行

python setup.py install

  正式编译通过,也算完美编译安装mxnet.

还有就是mxnet-mkl 这个加速版本以及mxnet-cuXX 版本安装参数该怎么配置,还需要再研究研究,时间有限,下次有时间再将安装心得分享。

Guess you like

Origin blog.csdn.net/jinhao_2008/article/details/104060814