On Wed, Aug 26, 2009 at 2:36 PM, Luis Ibanez<[email protected]> wrote: > On Tue, Aug 25, 2009 at 2:11 PM, James Bigler<[email protected]> wrote: >> This is code that is up for inclusion into the CMake Modules directory. >> >> FindCUDA does several things. >> >> 1. It locates all the build tools found in the NVIDIA CUDA toolkit and SDK. >> 2. It provides common options used to control CUDA code compilation. >> 3. It provides macros that setup the build rules to convert CUDA files >> into object code or PTX files. >> 4. It maintains source level dependencies. If you change a file that >> a CUDA file depends on, it will cause the CUDA file to recompile. >> >> Attached is a zip file that contains the 4 files needed for use. I >> needed to use a zip file to get below the 40 KB email size limit that >> didn't allow my email through before. >> >> 1. FindCUDA.cmake - main file that users call. >> 2. run_nvcc.cmake - script used to invoke the nvcc compiler and other >> helper commands (such as generating the dependency file). This file >> is configured per CUDA file, so that if you change one of the compiler >> options it will regenerate this file causing the CUDA file to be >> compiled anew. >> 3. make2cmake - converts the makefile formatted dependency file that >> nvcc produces into a form suitable for CMake to include. >> 4. parse_cubin.cmake - parses a cubin file generated by nvcc and >> reports statistics about the file. >> >> Comments are welcome. >> >> A version that also has some sample driver code (as well as the >> FindCUDA scripts) can be found here: >> >> svn checkout https://code.sci.utah.edu/svn/findcuda/trunk FindCUDA >> >> Thanks, >> James >> >> _______________________________________________ >> Powered by www.kitware.com >> >> Visit other Kitware open-source projects at >> http://www.kitware.com/opensource/opensource.html >> >> Please keep messages on-topic and check the CMake FAQ at: >> http://www.cmake.org/Wiki/CMake_FAQ >> >> Follow this link to subscribe/unsubscribe: >> http://www.cmake.org/mailman/listinfo/cmake >> > > ----------------------------------- > > > Hi James, > > This is great ! > > Thanks for putting it together and sharing it. > > > I tested it with the CUDA-ITK directory that we have > in the NAMIC Sandbox at: > > http://svn.na-mic.org/NAMICSandBox/trunk/CUDA-ITK/ > > where we used to have an older version of these files > in the subdirectory: > > http://svn.na-mic.org/NAMICSandBox/trunk/CUDA-ITK/CMake/cuda/ > > > -- > > Configuration with CMake went smoothly, > > but when building, I got the warning messages below > (at the end of this email). > > It would seem that some of the ITK C++ compilation > flags are passed to the cuda compiler, and get rejected. > > > Does that ring any bell ? > > > Thanks > > > Luis > > > > > ----------------------- > make > > > ~/bin/NAMIC/NAMICSandbox/CUDA-ITK/Release > [ 7%] Building NVCC (Device) object Source/./Example1_generated_Example1.cu.o > cc1: warning: command line option "-Wno-deprecated" is valid for > C++/Java/ObjC++ but not for C > cc1: warning: command line option "-ftemplate-depth-50" is valid for > C++/ObjC++ but not for C > cc1: warning: command line option "-Wno-deprecated" is valid for > C++/Java/ObjC++ but not for C > cc1: warning: command line option "-ftemplate-depth-50" is valid for > C++/ObjC++ but not for C > In file included from > /home/ibanez/src/NAMIC/NAMICSandBox/CUDA-ITK/Source/Example1.cu:119: > /tmp/tmpxft_00005d5f_00000000-1_Example1.cudafe1.stub.c: In function > ‘void __device_stub__Z15VectorAddKernelPfS_S_i(float*, float*, float*, > int)’: > /tmp/tmpxft_00005d5f_00000000-1_Example1.cudafe1.stub.c:9: warning: > dereferencing type-punned pointer will break strict-aliasing rules > /home/ibanez/local/Cuda/cuda/bin/../include/common_functions.h: At global > scope: > /home/ibanez/local/Cuda/cuda/bin/../include/common_functions.h:70: > warning: ‘clock_t __cuda_clock()’ defined but not used > /home/ibanez/local/Cuda/cuda/bin/../include/common_functions.h:75: > warning: ‘void* __cuda_memset(void*, int, size_t)’ defined but not > used > /home/ibanez/local/Cuda/cuda/bin/../include/common_functions.h:80: > warning: ‘void* __cuda_memcpy(void*, const void*, size_t)’ defined but > not used > Scanning dependencies of target Example1 > Linking CXX executable ../bin/Example1
Yes, all C or CXX flags get passed to the host compiler by nvcc via the -Xcompiler flag for more consistent builds. By default CUDA_HOST_COMPILATION_CPP is ON which should generate C++ host code and invoke the C++ compiler instead of the C compiler. I'm curious why you are getting problems like this. You can see the commands used to invoke nvcc by setting CUDA_VERBOSE_BUILD to ON and running the build again. James _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
