Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
975 views
in Technique[技术] by (71.8m points)

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 CodesCUDA_EXERCISESCUDA_EXERCISESCUDA_EXERCISES>"C:Program FilesNVIDIA GPU Computing ToolkitCUDAv4.2in
vcc.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.0VCin"  -I"C:Program FilesNVIDIA GPU Computing ToolkitCUDAv4.2include"  -G  --keep-dir "Debug" -maxrregcount=0  --machine 32 --compile  -g    -Xcompiler "/EHsc /nologo /Od /Zi  /MDd  " -o "DebugsimpleAtomicIntrinsics.cu.obj" "E:CUDA exercise CodesCUDA_EXERCISESCUDA_EXERCISESCUDA_EXERCISESsimpleAtomicIntrinsics.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 codescuda_exercisescuda_exercisescuda_exercisessimpleAtomicIntrinsics_kernel.cu(33): error : identifier "atomicAdd" is undefined
1>  
1>e:cuda exercise codescuda_exercisescuda_exercisescuda_exercisessimpleAtomicIntrinsics_kernel.cu(36): error : identifier "atomicSub" is undefined
1>  
1>e:cuda exercise codescuda_exercisescuda_exercisescuda_exercisessimpleAtomicIntrinsics_kernel.cu(39): error : identifier "atomicExch" is undefined
1>  
1>e:cuda exercise codescuda_exercisescuda_exercisescuda_exercisessimpleAtomicIntrinsics_kernel.cu(42): error : identifier "atomicMax" is undefined
1>  
1>e:cuda exercise codescuda_exercisescuda_exercisescuda_exercisessimpleAtomicIntrinsics_kernel.cu(45): error : identifier "atomicMin" is undefined
1>  
1>e:cuda exercise codescuda_exercisescuda_exercisescuda_exercisessimpleAtomicIntrinsics_kernel.cu(48): error : identifier "atomicInc" is undefined
1>  
1>e:cuda exercise codescuda_exercisescuda_exercisescuda_exercisessimpleAtomicIntrinsics_kernel.cu(51): error : identifier "atomicDec" is undefined
1>  
1>e:cuda exercise codescuda_exercisescuda_exercisescuda_exercisessimpleAtomicIntrinsics_kernel.cu(54): error : identifier "atomicCAS" is undefined
1>  
1>e:cuda exercise codescuda_exercisescuda_exercisescuda_exercisessimpleAtomicIntrinsics_kernel.cu(59): error : identifier "atomicAnd" is undefined
1>  
1>e:cuda exercise codescuda_exercisescuda_exercisescuda_exercisessimpleAtomicIntrinsics_kernel.cu(62): error : identifier "atomicOr" is undefined
1>  
1>e:cuda exercise codescuda_exercisescuda_exercisescuda_exercisessimpleAtomicIntrinsics_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)MSBuildMicrosoft.Cppv4.0BuildCustomizationsCUDA 4.2.targets(361,9): error MSB3721: The command ""C:Program FilesNVIDIA GPU Computing ToolkitCUDAv4.2in
vcc.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.0VCin"  -I"C:Program FilesNVIDIA GPU Computing ToolkitCUDAv4.2include"  -G  --keep-dir "Debug" -maxrregcount=0  --machine 32 --compile  -g    -Xcompiler "/EHsc /nologo /Od /Zi  /MDd  " -o "DebugsimpleAtomicIntrinsics.cu.obj" "E:CUDA exercise CodesCUDA_EXERCISESCUDA_EXERCISESCUDA_EXERCISESsimpleAtomicIntrinsics.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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Try to compile with the flag -arch sm_20


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...