Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error : identifier "atomicAdd" is undefined under visual studio 2010 & cuda 4.2 with Fermi GPU

I was trying to compile some CUDA codes under visual studio 2010 with CUDA 4.2 (I created this CUDA project using Parallel Nsight 2.2), but I encountered an atomic problem "error : identifier "atomicAdd" is undefined", which I still can't solve after checking several forums.

So I tried to get some information from CUDA SDK Samples. First, I ran the simpleAtomicIntrinsics sample in CUDA SDK, which passed its test. Then, I copied all the files in this sample to a new CUDA 4.2 project in visual studio 2010 and compiled them, Here is the result.

1>  E:\CUDA exercise Codes\CUDA_EXERCISES\CUDA_EXERCISES\CUDA_EXERCISES>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\bin\nvcc.exe" -gencode=arch=compute_20,code=\"sm_20,compute_20\" -gencode=arch=compute_20,code=\"sm_20,compute_20\" -gencode=arch=compute_10,code=\"sm_10,compute_10\" --use-local-env --cl-version 2010 -ccbin "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin"  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\include"  -G  --keep-dir "Debug" -maxrregcount=0  --machine 32 --compile  -g    -Xcompiler "/EHsc /nologo /Od /Zi  /MDd  " -o "Debug\simpleAtomicIntrinsics.cu.obj" "E:\CUDA exercise Codes\CUDA_EXERCISES\CUDA_EXERCISES\CUDA_EXERCISES\simpleAtomicIntrinsics.cu" 
1>  simpleAtomicIntrinsics.cu
1>  tmpxft_00007220_00000000-3_simpleAtomicIntrinsics.compute_20.cudafe1.gpu
1>  tmpxft_00007220_00000000-7_simpleAtomicIntrinsics.compute_20.cudafe2.gpu
1>  simpleAtomicIntrinsics.cu
1>e:\cuda exercise codes\cuda_exercises\cuda_exercises\cuda_exercises\simpleAtomicIntrinsics_kernel.cu(33): error : identifier "atomicAdd" is undefined
1>  
1>e:\cuda exercise codes\cuda_exercises\cuda_exercises\cuda_exercises\simpleAtomicIntrinsics_kernel.cu(36): error : identifier "atomicSub" is undefined
1>  
1>e:\cuda exercise codes\cuda_exercises\cuda_exercises\cuda_exercises\simpleAtomicIntrinsics_kernel.cu(39): error : identifier "atomicExch" is undefined
1>  
1>e:\cuda exercise codes\cuda_exercises\cuda_exercises\cuda_exercises\simpleAtomicIntrinsics_kernel.cu(42): error : identifier "atomicMax" is undefined
1>  
1>e:\cuda exercise codes\cuda_exercises\cuda_exercises\cuda_exercises\simpleAtomicIntrinsics_kernel.cu(45): error : identifier "atomicMin" is undefined
1>  
1>e:\cuda exercise codes\cuda_exercises\cuda_exercises\cuda_exercises\simpleAtomicIntrinsics_kernel.cu(48): error : identifier "atomicInc" is undefined
1>  
1>e:\cuda exercise codes\cuda_exercises\cuda_exercises\cuda_exercises\simpleAtomicIntrinsics_kernel.cu(51): error : identifier "atomicDec" is undefined
1>  
1>e:\cuda exercise codes\cuda_exercises\cuda_exercises\cuda_exercises\simpleAtomicIntrinsics_kernel.cu(54): error : identifier "atomicCAS" is undefined
1>  
1>e:\cuda exercise codes\cuda_exercises\cuda_exercises\cuda_exercises\simpleAtomicIntrinsics_kernel.cu(59): error : identifier "atomicAnd" is undefined
1>  
1>e:\cuda exercise codes\cuda_exercises\cuda_exercises\cuda_exercises\simpleAtomicIntrinsics_kernel.cu(62): error : identifier "atomicOr" is undefined
1>  
1>e:\cuda exercise codes\cuda_exercises\cuda_exercises\cuda_exercises\simpleAtomicIntrinsics_kernel.cu(65): error : identifier "atomicXor" is undefined
1>  
1>  11 errors detected in the compilation of "C:/Users/NIEXIA~1/AppData/Local/Temp/tmpxft_00007220_00000000-9_simpleAtomicIntrinsics.compute_10.cpp1.ii".
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\CUDA 4.2.targets(361,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\bin\nvcc.exe" -gencode=arch=compute_20,code=\"sm_20,compute_20\" -gencode=arch=compute_20,code=\"sm_20,compute_20\" -gencode=arch=compute_10,code=\"sm_10,compute_10\" --use-local-env --cl-version 2010 -ccbin "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin"  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\include"  -G  --keep-dir "Debug" -maxrregcount=0  --machine 32 --compile  -g    -Xcompiler "/EHsc /nologo /Od /Zi  /MDd  " -o "Debug\simpleAtomicIntrinsics.cu.obj" "E:\CUDA exercise Codes\CUDA_EXERCISES\CUDA_EXERCISES\CUDA_EXERCISES\simpleAtomicIntrinsics.cu"" exited with code 2.
1>
1>Build FAILED.

By the way, I can run other samples such as clock, matrixMul, etc. under this vs2010 CUDA Project. (This means the include path is set correctly)

I googled it and found the following link Some issue with Atomic add in CUDA kernel operation. I changed the properties of both project and the .cu file according to it, but still can't solve the problem.

Any suggestion?

like image 310
G_fans Avatar asked Dec 15 '22 21:12

G_fans


1 Answers

Try to compile with the flag -arch sm_20

like image 118
chaohuang Avatar answered Jan 08 '23 01:01

chaohuang