[CMake] HELP!CMAKE:CUDA_SDK example:nbody

王观武 eleven12147 at yahoo.com.cn
Wed Jun 2 04:51:24 EDT 2010


Hi,everyone!
I'm trying using CMAKE to complie a CUDA_SDK example:nbody;Of course I have noticed that Brian J. Davis wrote a article name"CUDA,CMAKE,and an attempt to build nbody"at CMAKE maillist in Jan 25 2010.I followed his advice and can build and run the executable,but the particles do not appear in the window,other graphics do like the graphics bar and the text appears.Davis also meeted this problem,and the I followed his solution but didn't get the right result:
1,SET(CUDA_NVCC_FLAGS_DEBUG -arch sm_10 -maxrregcount=32 -Xcompiler "/EHSC /W3 /nologo /Od /Zi" CACHE STRING "" FORCE)
2,SET(CUDA_64_BIT_DEUICE_CODE OFF)
3,ADD_DEFINITIONS(-D_HOWZ_ABOUT_THIS_DEF);
After this,There is no effect.Then I learned the vtkEdge's vtkKWEImageFFT which used cuda to compute.but get the same problem.I don't know why.I am a user of paraview:always uses the CMAKE,but didn't learn the CMAKE language.could anyone help me,please.Thanks a lot!!
This is my CMakeLists.txt:
find_package(Cuda)
set(KIT_SRCS nbody.cpp)#main() is in this file
if(CUDA_FOUND AND CUDA_CUTIL_FOUND)
    SET(KIT_CUDA_DEPENDANT_SRCS
                          bodySystemcpu.cpp
                          bodySystemcuda.cpp
                          nbody_gold.cpp
                          render_particles.cpp
                          paramgl.cpp)
    SET(KIT_CUDA_SOURCES bodysystemcuda.cu nbody_kernel.cu)
    include_directories(${CUDA_INCLUDE_DIR} ${CUDA_CUTIL_INCLUDE_DIR})
    SET(CUDA_NVCC_FLAGS_DEBUG -arch sm_10 -maxrregcount=32 -Xcompiler "/EHSC /W3 /nologo /Od /Zi" CACHE STRING "" FORCE)
    SET(CUDA_64_BIT_DEUICE_CODE OFF)
    ADD_DEFINITIONS(-D_HOWZ_ABOUT_THIS_DEF)
    CUDA_COMPILE(KIT_CUDA_C_SOURCES ${KIT_CUDA_SOURCES})
ENDIF(CUDA_FOUND AND CUDA_CUTIL_FOUND)
LINK_DIRECTORIES(${PROJECT_SOURCE_DIR}/lib)
set(KIT_LIBS glut32 glew32)
add_executable(nbodywgw ${KIT_CUDA_C_SOURCES} ${KIT_SRCS} ${CUDA_DEPENDANT_SRCS})
target_link_libraries(nbodywgw ${KIT_LIBS} ${CUDA_LIBRARIES} ${CUDA_CUTIL_LIBRARIES})
 
That's all.I'm hoping geting help!thanks~0~


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100602/2e93decd/attachment.htm>


More information about the CMake mailing list