编译twostreamfusion工程时遇到的问题

编译twostreamfusion工程时遇到的问题

编译环境说明:

  • ubuntu14.0.4
  • gcc4.8
  • cuda-8.0
  • matlab2015b

工程链接为:https://github.com/feichtenhofer/twostreamfusion

问题1:nvcc fatal : ‘.rodata’ can not be used when making a shared object; recompile with -fPIC

错误原因:只读数据不能被写入,需要用-fPIC进行重新编译
解决方法:找到工程的vl_compilenn.m文件,定位到411行,将此行修改为:flags.nvcc{end+1} = ‘–std=c++11 –compiler-options=-fPIC -Xcompiler -mssse3,-ffast-math’ ;

问题2:twostreamfusion/matconvnet/matlab/src/bits/impl/nnconv_cudnn.cu(135): error: too few arguments in function call

错误原因:cuda版本问题,正在使用的cuda的cudnnSetConvolution2dDescriptor函数定义存在区别,在cudnn.hpp中查看cudnnSetConvolution2dDescriptor的正确的调用方法:
cudnnSetConvolution2dDescriptor(*conv,
pad_h, pad_w, stride_h, stride_w, 1, 1, CUDNN_CROSS_CORRELATION,
dataType::type);
解决方法:在twostreamfusion/matconvnet/matlab/src/bits/impl/nnconv_cudnn.cu的135行以及352行改为如下:主要添加参数:CUDNN_DATA_DOUBLE。
CHECK(cudnnSetConvolution2dDescriptor(convDesc,
padLeft, padTop,
strideX, strideY,
1,1, // upscale
CUDNN_CROSS_CORRELATION,CUDNN_DATA_DOUBLE)) ;

你可能感兴趣的:(c++,cuda,twostreamfusion)