I fixed missing pointer initializations to get rid of warnings. After that your code compiled without warnings or errors for me (CUDA 7.5, MSVS 2010, Win7 64). What is your exact nvcc command line, and what errors messages are emitted by the compiler?
Hi,njuffa
points initialization don’t resolve my problem. The error messages are:
syntax error:missing ‘;’ before ‘constant’
syntax error:‘>’
both on line 9(the same line as code “addKernel<<<1,512>>>()”).
If I initialtize addKernel directly in main function, it is ok.If I compile the above codes on vs2012, it is ok.
The nvcc command lines are as follows:
error MSB3721: The command ““C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\bin\nvcc.exe” -gencode=arch=compute_20,code="sm_20,compute_20" --use-local-env --cl-version 2013 -ccbin “C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64” -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\include” -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\include" --keep-dir x64\Release -maxrregcount=0 --machine 64 --compile -cudart static -DWIN32 -DWIN64 -DNDEBUG -D_CONSOLE -D_MBCS -Xcompiler “/EHsc /W3 /nologo /O2 /Zi /MD " -o x64\Release\kernel.cu.obj “C:\Users\dmsuvorov\Documents\Visual Studio 2013\Projects\cuda_test\cuda_test\kernel.cu”” exited with code 2.
Your original post stated that you are using CUDA 7.0, but the compilation log above shows that the compiler from CUDA 6.5 is being used.
Is it possible your compiler configuration is corrupted? Mixing files from different CUDA releases can definitely cause weird compiler problems as I know from personal experience.
As I stated, I performed my experiment with CUDA 7.5, so you might want to try that. (I migrated straight from CUDA 6.5 to CUDA 7.5, as CUDA 7.0 seemed to have too many bugs).