matconv-GPU 编译问题

如出现以下错误:

1 error detected in the compilation of "C:/Users/Justin/AppData/Local/Temp/tmpxft_00001afc_00000000-8_pooling_gpu.cpp1.ii".
pooling_gpu.cu
Error using vl_compilenn>nvcc_compile (line 521)
Command "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin\nvcc" -c
"C:\Users\Justin\Documents\MATLAB\matconvnet-1.0-beta20\matlab\src\bits\impl\pooling_gpu.cu" -DNDEBUG -DENABLE_GPU -DENABLE_DOUBLE -D__SSSE3__
-gencode=arch=compute_61,code="sm_61,compute_61" -I"C:\Program Files\MATLAB\R2016a\extern\include" -I"C:\Program
Files\MATLAB\R2016a\toolbox\distcomp\gpu\extern\include" -gencode=arch=compute_61,code="sm_61,compute_61" -Xcompiler /MD -o
"C:\Users\Justin\Documents\MATLAB\matconvnet-1.0-beta20\matlab\mex.build\bits\impl\pooling_gpu.obj" failed.

Error in vl_compilenn (line 466)
nvcc_compile(opts, srcs{i}, objfile, flags.nvcc) ;

 

 

则要修改上面错误中红色字体的.cu文件

在163行的函数用下面替换

// an implementation of atomicAdd() for double (really slow)
#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 600
#else
__device__ double atomicAdd(double* address, double val)
{
unsigned long long int* address_as_ull = (unsigned long long int*)address;
unsigned long long int old = *address_as_ull, assumed;
do {
assumed = old;
old = atomicCAS(address_as_ull, assumed,
__double_as_longlong(val +
__longlong_as_double(assumed)));
} while (assumed != old);
return __longlong_as_double(old);
}
#endif

 

 

posted @ 2018-11-21 18:08  burton_shi  阅读(1797)  评论(0编辑  收藏  举报