在使用cuda9 安装mxnet时出现error : invalid union member -- class "__half" has a disallowed member function
纠结了一会,查询cuda8.0 发现,cuda_fp16.h在cuda9中变成了cuda_fp16.hpp,
__half变成了class,所以在mxnet\mshadow\mshadow\half.h中
class MSHADOW_ALIGNED(2) half_t { public: union { uint16_t half_; #if MSHADOW_CUDA_HALF __half cuhalf_; #endif // MSHADOW_CUDA_HALF };
提示不能再union中使用class __half
于是改成:
class MSHADOW_ALIGNED(2) half_t { public: union { uint16_t half_; #if MSHADOW_CUDA_HALF struct { __half cuhalf_; }; //changed by sky #endif // MSHADOW_CUDA_HALF };
编译通过。
小结mxnet安装:
下载MXnet
git clone --recursive https://github.com/dmlc/mxnet
使用
--recursive下载mxnet 附带依赖包否则,会提示缺少一些包
MXnet
依赖第三方库:Gtest,openblas或者mkl,opencv,cuda9,cudnn7
caffe插件需要链接CAFFE_PATH,caffe下include 和src需要拷贝一份至build/x64/release下