https://github.com/vlfeat/matconvnet/issues/575

 

나도 아래의 Ben의 방법대로 고쳤더니 pooling_gpu.cu (line 163), bilinearsampler_gpu.cu (line 25)를 수정했더니 고쳐짐

 

 

jlee614 commented on Jun 11 edited

Hi,

I downloaded the last version of MatConvNet (ver1.0-beta20) and tried compiling with GPU support.

I have a GTX1080 card which requires CUDA 8.0 (otherwise there's an error: "nvcc fatal : Unsupported gpu architecture 'compute_61' ")

Anyways, when I try to compile with CUDA 8.0, it seems to work for the most part but then I get the following:

vl_compilenn: CUDA: MEX config file: 'C:\Program Files\MATLAB\R2016a\toolbox\distcomp\gpu\extern\src\mex\win64\mex_CUDA_win64.xml'
data.cu
datamex.cu
nnconv.cu
nnfullyconnected.cu
nnsubsample.cu
nnpooling.cu
nnnormalize.cu
nnbnorm.cu
nnbias.cu
nnbilinearsampler.cu
Building with 'Microsoft Visual C++ 2013 Professional'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2013 Professional'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2013 Professional'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2013 Professional'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2013 Professional'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2013 Professional'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2013 Professional'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2013 Professional'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2013 Professional'.
MEX completed successfully.
im2row_gpu.cu
subsample_gpu.cu
copy_gpu.cu
> C:/Users/Justin/Documents/MATLAB/matconvnet-1.0-beta20/matlab/src/bits/impl/pooling_gpu.cu(163): error: function "atomicAdd(double *, double)" has already been defined

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) ;

I googled for the error bolded and came across this link which I think may have something to with what's going on:
[http://stackoverflow.com/questions/37566987/cuda-atomicadd-for-doubles-definition-error]

I don't know if it's a proper fix or not, but I ended up doing the following:

pooling_gpu.cu, line 163
(commented out atomicadd)

bilinearsampler_gpu.cu, line 25
(commented out atomicadd)

This made the compiling work and I ran vl_testnn without any problems after compiling. Posting this here in case anyone else has the same problem and also if anyone has any further insights as to what caused the problem and what issues may arise from me commenting out the lines above.

Thanks!
-Justin

 

------------------------------------------------------------------------------------

missilzolair commented on Jun 12

Hi,

I just encounter the same issue, except that I am using a gtx970, with compute capability 5.2. Apparently, it's related to the fact that with Pascal (compute capability 6.0) a native double version of atomicAdd has been added.

In my case, if I simply comment the overloaded definition of atomicAdd, I will still get an error. The right solution (http://stackoverflow.com/questions/37566987/cuda-atomicadd-for-doubles-definition-error/37569519) is to use the following macro:

#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 600
#else
<... place here your own pre-pascal atomicAdd definition ...>
#endif

I added the aforementioned macro at the two locations that Justin mentioned and the code compiles just fine with CUDA 8.0 on gpu architecture < 6.0.

Cheers,
Ben

 

------------------------------------------------------------------------------------

 

jlee614 commented on Jun 13

Ben,

Thanks for your help! I came across that same link (sorry, I had my syntax wrong and it didn't post properly the first time), and your suggestion is the correct one.

Thanks again!
Justin

 

------------------------------------------------------------------------------------

 

lenck commented on Jun 14

Thanks @jlee614 for the report and @missilzolair for suggesting the bugfix!
It's now pushed to the master...

 

 

Posted by uniqueone
,