在使用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下