Hi,everyone!
I’m using cmake to complie a CUDA_SDK example:nbody;I have noticed that Brian J. Davis wrote a article named"CUDA,CMAKE,and an attempt to build nbody"at cmake maillists inJan 25 2010.I followed his advice and can build and run the executable,but the particles do not appear in the window,at the same time other graphics do like the graphics bar and the text appears.I then make this code as a plugin loaded into the ParaView.and found that a point(0.9,0.9,0.9 become (3.4e+38,3.4e+38,3.4e+38){=(0,0,0)}when use this library’s function.So I think that I complie the CUDA with wrong options.although i have build it .but it is wrong.
What i want to do is copmlie the CUDA_SDK’s CUDA code as a library,then my own program can use this library in a red hat linux.and my first step is the nbody program.I have read Forums’ many articles about this.but didn’t get the point.do anyone can give me same advice or post his CMakeLists.txt file here.Thanks a lot!I am hope of help~0~If I overcome this problem,I will post my solution here step by step.
Thanks Reading!
Oh~today,I copy My program to my Win32 system.it is work and get the right result.but when it run in linux~it works but the result is worng!!!Then there is only some reasons:1,I intall wrong CUDA versons.then the library is different.I used cuda2.0_wind32 for windows and used NVIDIA_CUDA_toolkit_2.0_rhel4.6_x86.run for my 4.2.1.10 red hat linux.does this linux verson is low.but i didn’t find a toolkit_2.0_rhel4.2_x86.run?2:I compile CUDA code in windows under debug,then there is something compile options diffent between linux and windows??
by the way ,My cuda_toolkit doesn’t have the libcutil.a ,but only libcutil.so.and when run in windows,i link the cutil32D.lib.is this the reason?oh this is driving me crazy~
FindCUDA.cmake does a couple of things with flags.
- It adds -m32 or -m64 based on the CUDA_64_BIT_DEVICE_CODE CMake variable. This variable is initialized based on the bitness of the host compile (CMAKE_SIZE_OF_VOID_P).
- It passes host compiler flags to the code compiled by the host. Note that the flag propagation can be turned off by setting CUDA_PROPAGATE_HOST_FLAGS to TRUE.
You can see the nvcc commands by running either ‘make VERBOSE=1’ in makefiles or by specifying CUDA_VERBOSE_BUILD to TRUE via ccmake or cmake-gui. With this, you should be able to compare the flags being used on windows with linux.
Also, it might be useful to try the latest version of CUDA. 2.0 is four versions behind the current release (2.1, 2.2, 2.3, 3.0).
Thanks~JBigler!
today,I followed you advice,Then I get the complie flags in windows and linux:
Windows:
C:/CUDA/bin/nvcc.exe E:/MapperProject/Particle2Reader/particleSystem.cu -c -o E:/MapperProject/Particle2ReaderBuild/debug/particles_generated_particleSystem.cu.obj -m32 -D_HOWZ_ABOUT_THIS_DEF -Xcompiler ,"/DWIN32","/D_WINDOWS","/W3","/Zm1000","/EHsc","/GR","/D_DEBUG","/MDd","/Zi","/0b0","/Od","/RTC1" -maxrregcount=32 -arch sm_11 -DNVCC -I…
Linux:
…nvcc /home/program/wgw/project/Particle2Reader/particleSystem.cu -c -o /home/program/wgw/project/Particle2ReadeD/./particles_generated_particleSystem.cu.o -m32 -D_HOWZ_ABOUT_THIS_DEF -Xcomplier ,"/-g" -arch=sm_11 -maxrregcount=32 -DNVCC -I…
Then,only the -Xcomplier flag is diffenent.I know the Xcomplier flags in windows can not transform to linux directly.So i confused again.Is this the point?do you have any advance advice.Now I will dowmload the CUDA2.3 and try again~
I am hoping of your reply~Thanks reading!
Did the newer version of CUDA help anything?