如出现以下错误:
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 FilesNVIDIA GPU Computing ToolkitCUDAv8.0in
vcc" -c
"C:UsersJustinDocumentsMATLABmatconvnet-1.0-beta20matlabsrcitsimplpooling_gpu.cu" -DNDEBUG -DENABLE_GPU -DENABLE_DOUBLE -D__SSSE3__
-gencode=arch=compute_61,code="sm_61,compute_61" -I"C:Program FilesMATLABR2016aexterninclude" -I"C:Program
FilesMATLABR2016a oolboxdistcompgpuexterninclude" -gencode=arch=compute_61,code="sm_61,compute_61" -Xcompiler /MD -o
"C:UsersJustinDocumentsMATLABmatconvnet-1.0-beta20matlabmex.builditsimplpooling_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