[CMake] CUDA, CMAKE, and an attempt to build nbody

Brian Davis bitminer at gmail.com
Mon Jan 25 16:58:40 EST 2010


I have overcome the issues with MSVCR90D.dll and MSVCP90d.dll by installing
Visual Studio 9 SP1.  Which seems to fix references to amd64 dlls.  Why this
is not in the web update is anyone's guess.  Just more MS super spectacular
awesomeness.

Now on to my latest (CMAKE) problem.  I can build and run the executable,
but the particles do not appear in the window.  Other graphics do like the
graphics bars and the text, for those that are familiar with this demo app.
So I begin to look at the compiler settings.

Nvidia:

"C:\CUDA_2.2\bin\nvcc.exe"
-arch sm_10
-ccbin "c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin"
-Xcompiler "/EHsc /W3 /nologo /Od /Zi   /MTd  "
-I"C:\CUDA_2.2\include"
-I"./"
-I"../../common/inc"
-maxrregcount=32
--compile
-o "x64\Debug\bodysystemcuda.cu.obj"
"c:\CUDA_SDK_2.2\NVIDIA Corporation\NVIDIA CUDA SDK\projects\nbody\
bodysystemcuda.cu"

In my attempt using CMAKE (if I let cmake do it's thing):

using (note commented out lines):

SET_TARGET_PROPERTIES(
    nbody
    PROPERTIES
    COMPILE_DEFINITIONS _HOWZ_ABOUT_THIS_DEF
#    COMPILE_FLAGS_DEBUG "-arch sm_10 -maxrregcount=32"
#    CUDA_NVCC_FLAGS_DEBUG "/EHsc /W3 /nologo /Od /Zi"

)

2>C:/projects/NIH2009/source/branches/trunk/source/cpp/lib/3rdParty/Win/CUDA_Toolkit_2.2/bin/nvcc.exe

C:/projects/NIH2009/source/branches/trunk/source/cpp/app/testing/cudaTests/nbody/src/
bodysystemcuda.cu
-m64
-ccbin "c:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin"
-Xcompiler
,\"/DWIN32\",\"/D_WINDOWS\",\"/W3\",\"/Zm1000\",\"/EHsc\",\"/GR\",\"/D_DEBUG\",\"/MTd\",\"/Zi\",\"/Ob0\",\"/Od\",\"/RTC1\",\"/Gm\"

-DNVCC -M -o
C:/projects/NIH2009/source/branches/trunk/build/dvip4-Win64/cpp_source/app/nbody/CMakeFiles/nbody_generated_bodysystemcuda.cu.obj.NVCC-depend

-IC:/projects/NIH2009/source/branches/trunk/source/cpp/lib/3rdParty/Win/CUDA_Toolkit_2.2/include

-IC:/projects/NIH2009/source/branches/trunk/source/cpp/lib/3rdParty/Win/NVIDIA_GPU_Computing_SDK_2.2/common/inc

-IC:/projects/NIH2009/source/branches/trunk/source/cpp/lib/3rdParty/Win/CUDA_Toolkit_2.2/include


First off note the additions of:
-m64
and -Xcompiler flags of
/DWIN32\",\"/D_WINDOWS\",\"/W3\",\"/Zm1000\",\"/GR\",\"/D_DEBUG\",
",\"/Ob0\",\"/RTC1\",\"/Gm\

And the missing bits:
-maxrregcount=32
-arch sm_10

So I then try:

SET_TARGET_PROPERTIES(
    nbody
    PROPERTIES
    COMPILE_DEFINITIONS _HOWZ_ABOUT_THIS_DEF
    COMPILE_FLAGS_DEBUG "-arch sm_10 -maxrregcount=32"
#    CUDA_NVCC_FLAGS_DEBUG "/EHsc /W3 /nologo /Od /Zi"

)

or

SET_TARGET_PROPERTIES(
    nbody
    PROPERTIES
    COMPILE_DEFINITIONS _HOWZ_ABOUT_THIS_DEF
    COMPILE_FLAGS "-arch sm_10 -maxrregcount=32"
#    CUDA_NVCC_FLAGS_DEBUG "/EHsc /W3 /nologo /Od /Zi"

)

Which has no effect (well it does, just not the desired effect)


I also try in vain:

SET_TARGET_PROPERTIES(
    nbody
    PROPERTIES
    COMPILE_DEFINITIONS _HOWZ_ABOUT_THIS_DEF
#    COMPILE_FLAGS "-arch sm_10 -maxrregcount=32"
    CUDA_NVCC_FLAGS_DEBUG "/EHsc /W3 /nologo /Od /Zi"

)

Which also has no effect.

So I try (Which I feel is heavy handed):


SET( CUDA_NVCC_FLAGS_DEBUG -arch sm_10 -maxrregcount=32 CACHE STRING ""
FORCE )


Which gives me:

2>C:/projects/NIH2009/source/branches/trunk/source/cpp/lib/3rdParty/Win/CUDA_Toolkit_2.2/bin/nvcc.exe

C:/projects/NIH2009/source/branches/trunk/source/cpp/app/testing/cudaTests/nbody/src/
bodysystemcuda.cu
-arch sm_10
-maxrregcount=32
-m64
-ccbin "c:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin"
-Xcompiler
,\"/DWIN32\",\"/D_WINDOWS\",\"/W3\",\"/Zm1000\",\"/EHsc\",\"/GR\",\"/D_DEBUG\",\"/MTd\",\"/Zi\",\"/Ob0\",\"/Od\",\"/RTC1\",\"/Gm\"

-DNVCC
-c
-o
C:/projects/NIH2009/source/branches/trunk/build/dvip4-Win64/cpp_source/app/nbody/Debug/nbody_generated_bodysystemcuda.cu.obj

-IC:/projects/NIH2009/source/branches/trunk/source/cpp/lib/3rdParty/Win/CUDA_Toolkit_2.2/include

-IC:/projects/NIH2009/source/branches/trunk/source/cpp/lib/3rdParty/Win/NVIDIA_GPU_Computing_SDK_2.2/common/inc

-IC:/projects/NIH2009/source/branches/trunk/source/cpp/lib/3rdParty/Win/CUDA_Toolkit_2.2/include


Which gives me:
-arch sm_10
_maxrrcount=32

but there is still the pesky
-m64

How do I remove this?

I then try:

SET( CUDA_NVCC_FLAGS_DEBUG -arch sm_10 -maxrregcount=32 -Xcompiler "/EHsc
/W3 /nologo /Od /Zi" CACHE STRING "" FORCE )

2>C:/projects/NIH2009/source/branches/trunk/source/cpp/lib/3rdParty/Win/CUDA_Toolkit_2.2/bin/nvcc.exe

C:/projects/NIH2009/source/branches/trunk/source/cpp/app/testing/cudaTests/nbody/src/
nbody_kernel.cu
-arch sm_10 -maxrregcount=32
-Xcompiler "/EHsc /W3 /nologo /Od /Zi"
-m64
-ccbin "c:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin"
-Xcompiler
,\"/DWIN32\",\"/D_WINDOWS\",\"/W3\",\"/Zm1000\",\"/EHsc\",\"/GR\",\"/D_DEBUG\",\"/MTd\",\"/Zi\",\"/Ob0\",\"/Od\",\"/RTC1\",\"/Gm\"

-DNVCC
-M
-o
C:/projects/NIH2009/source/branches/trunk/build/dvip4-Win64/cpp_source/app/nbody/CMakeFiles/nbody_generated_nbody_kernel.cu.obj.NVCC-depend

-IC:/projects/NIH2009/source/branches/trunk/source/cpp/lib/3rdParty/Win/CUDA_Toolkit_2.2/include
-IC:/projects/NIH2009/source/branches/trunk/source/cpp/lib/3rdParty/Win/NVIDIA_GPU_Computing_SDK_2.2/common/inc

-IC:/projects/NIH2009/source/branches/trunk/source/cpp/lib/3rdParty/Win/CUDA_Toolkit_2.2/include


Which of course adds -Xcompiler flags, but does not override the existing.
How do I do this?  And what is the least heavy handed way of doing it?



-- 
Brian J. Davis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100125/2285fecd/attachment-0001.htm>


More information about the CMake mailing list