mxnet环境搭建随记
安装mxnet还是遇到不少麻烦事,现在简单记一下,挖个坑,后续详细补充,打算写一下我的mxnet探索之旅。
更新: 具体安装mxnet,cuda,opencv过程已经补坑——点击进入
不知道为什么,在cuda7.5+ubuntu14.04amd64 + opencv2.4.13时,会显卡驱动有问题,无法显示桌面.但是可以正常使用。后续我改为16.04+cuda8.0rc+opencv2.4.13,解决了桌面显示问题且正常使用,但是在想把opencv2.4.13换为opencv3.10时,编译opencv3.10时会报错,关于cudalegacy模块,如下;
/home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:120:54: error: ‘NppiGraphcutState’ has not been declared typedef NppStatus (*init_func_t)(NppiSize oSize, NppiGraphcutState** ppStat ^ /home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:135:18: error: ‘NppiGraphcutState’ does not name a type operator NppiGraphcutState*() ^ /home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:141:9: error: ‘NppiGraphcutState’ does not name a type NppiGraphcutState* pState; ^ In file included from /home/ecarx/opencv-3.1.0/build/modules/cudalegacy/precomp.hpp:75:0: /home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp: In constructor ‘{anonymous}::NppiGraphcutStateHandler::NppiGraphcutStateHandler(NppiSize, Npp8u*, {anonymous}::init_func_t)’: /home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:127:39: error: ‘pState’ was not declared in this scope nppSafeCall( func(sznpp, &pState, pDeviceMem) ); ^ /home/ecarx/opencv-3.1.0/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’ #define nppSafeCall(expr) cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV ^ /home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp: In destructor ‘{anonymous}::NppiGraphcutStateHandler::~NppiGraphcutStateHandler()’: /home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:132:43: error: ‘pState’ was not declared in this scope nppSafeCall( nppiGraphcutFree(pState) ); ^ /home/ecarx/opencv-3.1.0/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’ #define nppSafeCall(expr) cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV ^ /home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:132:49: error: ‘nppiGraphcutFree’ was not declared in this scope nppSafeCall( nppiGraphcutFree(pState) ); ^ /home/ecarx/opencv-3.1.0/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’ #define nppSafeCall(expr) cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV ^ /home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp: In function ‘void cv::cuda::graphcut(cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::Stream&)’: /home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:174:51: error: ‘nppiGraphcutGetSize’ was not declared in this scope nppSafeCall( nppiGraphcutGetSize(sznpp, &bufsz) ); ^ /home/ecarx/opencv-3.1.0/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’ #define nppSafeCall(expr) cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV ^ /home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:182:61: error: ‘nppiGraphcutInitAlloc’ was not declared in this scope NppiGraphcutStateHandler state(sznpp, buf.ptr<Npp8u>(), nppiGraphcutInitAll ^ In file included from /home/ecarx/opencv-3.1.0/build/modules/cudalegacy/precomp.hpp:75:0: /home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:191:146: error: ‘nppiGraphcut_32s8u’ was not declared in this scope nsp.step), sznpp, labels.ptr<Npp8u>(), static_cast<int>(labels.step), state) ); ^ /home/ecarx/opencv-3.1.0/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’ #define nppSafeCall(expr) cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV ^ /home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:196:146: error: ‘nppiGraphcut_32f8u’ was not declared in this scope nsp.step), sznpp, labels.ptr<Npp8u>(), static_cast<int>(labels.step), state) ); ^ /home/ecarx/opencv-3.1.0/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’ #define nppSafeCall(expr) cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV ^ /home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp: In function ‘void cv::cuda::graphcut(cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::GpuMat&, cv::cuda::Stream&)’: /home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:246:52: error: ‘nppiGraphcut8GetSize’ was not declared in this scope nppSafeCall( nppiGraphcut8GetSize(sznpp, &bufsz) ); ^ /home/ecarx/opencv-3.1.0/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’ #define nppSafeCall(expr) cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV ^ /home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:254:61: error: ‘nppiGraphcut8InitAlloc’ was not declared in this scope NppiGraphcutStateHandler state(sznpp, buf.ptr<Npp8u>(), nppiGraphcut8InitAl ^ In file included from /home/ecarx/opencv-3.1.0/build/modules/cudalegacy/precomp.hpp:75:0: /home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:267:146: error: ‘nppiGraphcut8_32s8u’ was not declared in this scope nsp.step), sznpp, labels.ptr<Npp8u>(), static_cast<int>(labels.step), state) ); ^ /home/ecarx/opencv-3.1.0/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’ #define nppSafeCall(expr) cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV ^ /home/ecarx/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp:274:146: error: ‘nppiGraphcut8_32f8u’ was not declared in this scope nsp.step), sznpp, labels.ptr<Npp8u>(), static_cast<int>(labels.step), state) ); ^ /home/ecarx/opencv-3.1.0/modules/core/include/opencv2/core/private.cuda.hpp:165:52: note: in definition of macro ‘nppSafeCall’ #define nppSafeCall(expr) cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV ^ modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/build.make:290: recipe for target 'modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/src/graphcuts.cpp.o' failed make[2]: *** [modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/src/graphcuts.cpp.o] Error 1 make[2]: *** 正在等待未完成的任务.... [ 73%] Linking CXX executable ../../bin/opencv_perf_photo CMakeFiles/Makefile2:9117: recipe for target 'modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/all' failed make[1]: *** [modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/all] Error 2 make[1]: *** 正在等待未完成的任务.... [ 73%] Built target opencv_perf_photo Makefile:160: recipe for target 'all' failed make: *** [all] Error 2
经多次尝试,都不成功。暂时放弃使用,初步猜测是因为,opencv3.10是2015年年末发行的,cuda8.0rc是2016.05发行的,所以本身opencv3.10不支持cuda8.0rc,但是我还没有去github问(opencv2.4.13是2016.05发行,使用正常),后续还会再尝试,到时再更新。
我个人是因为硬件问题,所以环境选ubuntu16.04+cuda8.0rc。如果没这个限制最好选择比最新版本低一个版本,以求稳定。
不得不说,搭建环境很耗时间,环境稳定后,不要轻易改变。