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 [ 7%] Built target Example1 [ 15%] Building NVCC (Device) object Source/./Example2_generated_Example2.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/Example2.cu:236: /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 Example2 [ 23%] Building CXX object Source/CMakeFiles/Example2.dir/Example2.o /home/ibanez/src/NAMIC/NAMICSandBox/CUDA-ITK/Source/Example2.cxx: In function ‘int main(int, char**)’: /home/ibanez/src/NAMIC/NAMICSandBox/CUDA-ITK/Source/Example2.cxx:62: warning: ‘imageDestination’ is used uninitialized in this function /home/ibanez/src/NAMIC/NAMICSandBox/CUDA-ITK/Source/Example2.cxx:62: warning: ‘stride’ is used uninitialized in this function Linking CXX executable ../bin/Example2 [ 23%] Built target Example2 [ 30%] Building NVCC (Device) object Examples/ContrastBrightness/./BrightnessContrast_generated_BrightnessContrast.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/Examples/ContrastBrightness/BrightnessContrast.cu:105: /tmp/tmpxft_00005e1a_00000000-1_BrightnessContrast.cudafe1.stub.c: In function ‘void __device_stub__Z24BrightnessContrastKernelP6uchar4iiiff(uchar4*, int, int, int, float, float)’: /tmp/tmpxft_00005e1a_00000000-1_BrightnessContrast.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 BrightnessContrast [ 38%] Building CXX object Examples/ContrastBrightness/CMakeFiles/BrightnessContrast.dir/ImageUtils.o /home/ibanez/src/NAMIC/NAMICSandBox/CUDA-ITK/Examples/ContrastBrightness/ImageUtils.cpp:38: warning: ignoring #pragma warning /home/ibanez/src/NAMIC/NAMICSandBox/CUDA-ITK/Examples/ContrastBrightness/ImageUtils.cpp: In function ‘unsigned char* LoadBMPImage(char*, int*, int*, int*)’: /home/ibanez/src/NAMIC/NAMICSandBox/CUDA-ITK/Examples/ContrastBrightness/ImageUtils.cpp:119: warning: comparison between signed and unsigned integer expressions [ 46%] Building CXX object Examples/ContrastBrightness/CMakeFiles/BrightnessContrast.dir/main.o /home/ibanez/src/NAMIC/NAMICSandBox/CUDA-ITK/Examples/ContrastBrightness/main.cpp:37: warning: ignoring #pragma warning /home/ibanez/src/NAMIC/NAMICSandBox/CUDA-ITK/Examples/ContrastBrightness/main.cpp: In function ‘int main(int, char**)’: /home/ibanez/src/NAMIC/NAMICSandBox/CUDA-ITK/Examples/ContrastBrightness/main.cpp:89: warning: dereferencing type-punned pointer will break strict-aliasing rules Linking CXX executable ../../bin/BrightnessContrast [ 46%] Built target BrightnessContrast [ 53%] Building NVCC (Device) object Examples/Convolution3x3/./Convolution3x3_generated_Convolution3x3.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/Examples/Convolution3x3/Convolution3x3.cu:221: /tmp/tmpxft_00005e80_00000000-1_Convolution3x3.cudafe1.stub.c: In function ‘void __device_stub__Z20Convolution3x3KernelP6uchar4S0_iii(uchar4*, uchar4*, int, int, int)’: /tmp/tmpxft_00005e80_00000000-1_Convolution3x3.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 Convolution3x3 [ 61%] Building CXX object Examples/Convolution3x3/CMakeFiles/Convolution3x3.dir/ImageUtils.o /home/ibanez/src/NAMIC/NAMICSandBox/CUDA-ITK/Examples/Convolution3x3/ImageUtils.cpp:38: warning: ignoring #pragma warning /home/ibanez/src/NAMIC/NAMICSandBox/CUDA-ITK/Examples/Convolution3x3/ImageUtils.cpp: In function ‘unsigned char* LoadBMPImage(char*, int*, int*, int*)’: /home/ibanez/src/NAMIC/NAMICSandBox/CUDA-ITK/Examples/Convolution3x3/ImageUtils.cpp:119: warning: comparison between signed and unsigned integer expressions [ 69%] Building CXX object Examples/Convolution3x3/CMakeFiles/Convolution3x3.dir/main.o /home/ibanez/src/NAMIC/NAMICSandBox/CUDA-ITK/Examples/Convolution3x3/main.cpp: In function ‘int main(int, char**)’: /home/ibanez/src/NAMIC/NAMICSandBox/CUDA-ITK/Examples/Convolution3x3/main.cpp:65: warning: dereferencing type-punned pointer will break strict-aliasing rules /home/ibanez/src/NAMIC/NAMICSandBox/CUDA-ITK/Examples/Convolution3x3/main.cpp:66: warning: dereferencing type-punned pointer will break strict-aliasing rules Linking CXX executable ../../bin/Convolution3x3 [ 69%] Built target Convolution3x3 [ 76%] Building NVCC (Device) object Examples/ImageRotate/./ImageRotate_generated_ImageRotate.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/Examples/ImageRotate/ImageRotate.cu:179: /tmp/tmpxft_00005eea_00000000-1_ImageRotate.cudafe1.stub.c: In function ‘void __device_stub__Z12RotateKernelP6uchar4iiif(uchar4*, int, int, int, float)’: /tmp/tmpxft_00005eea_00000000-1_ImageRotate.cudafe1.stub.c:10: warning: dereferencing type-punned pointer will break strict-aliasing rules /tmp/tmpxft_00005eea_00000000-1_ImageRotate.cudafe1.stub.c: In function ‘void __device_stub__Z31convertBGR_U8_to_RGBA_U8_kernelP6uchar4iii(uchar4*, int, int, int)’: /tmp/tmpxft_00005eea_00000000-1_ImageRotate.cudafe1.stub.c:18: 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 ImageRotate [ 84%] Building CXX object Examples/ImageRotate/CMakeFiles/ImageRotate.dir/ImageUtils.o /home/ibanez/src/NAMIC/NAMICSandBox/CUDA-ITK/Examples/ImageRotate/ImageUtils.cpp:38: warning: ignoring #pragma warning /home/ibanez/src/NAMIC/NAMICSandBox/CUDA-ITK/Examples/ImageRotate/ImageUtils.cpp: In function ‘unsigned char* LoadBMPImage(char*, int*, int*, int*)’: /home/ibanez/src/NAMIC/NAMICSandBox/CUDA-ITK/Examples/ImageRotate/ImageUtils.cpp:119: warning: comparison between signed and unsigned integer expressions [ 92%] Building CXX object Examples/ImageRotate/CMakeFiles/ImageRotate.dir/main.o /home/ibanez/src/NAMIC/NAMICSandBox/CUDA-ITK/Examples/ImageRotate/main.cpp: In function ‘int main(int, char**)’: /home/ibanez/src/NAMIC/NAMICSandBox/CUDA-ITK/Examples/ImageRotate/main.cpp:67: warning: dereferencing type-punned pointer will break strict-aliasing rules /home/ibanez/src/NAMIC/NAMICSandBox/CUDA-ITK/Examples/ImageRotate/main.cpp:78: warning: dereferencing type-punned pointer will break strict-aliasing rules Linking CXX executable ../../bin/ImageRotate [ 92%] Built target ImageRotate [100%] Building NVCC (Device) object Examples/VectorAdd/./HelloWorld_generated_hello_world.cu.o /home/ibanez/src/NAMIC/NAMICSandBox/CUDA-ITK/Examples/VectorAdd/hello_world.cu(37): warning: variable "err" was set but never used 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 /home/ibanez/src/NAMIC/NAMICSandBox/CUDA-ITK/Examples/VectorAdd/hello_world.cu(37): warning: variable "err" was set but never used In file included from /home/ibanez/src/NAMIC/NAMICSandBox/CUDA-ITK/Examples/VectorAdd/hello_world.cu:68: /tmp/tmpxft_00005f50_00000000-1_hello_world.cudafe1.stub.c: In function ‘void __device_stub__Z15VectorAddKernelPfS_S_i(float*, float*, float*, int)’: /tmp/tmpxft_00005f50_00000000-1_hello_world.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 HelloWorld Linking CXX executable ../../bin/HelloWorld [100%] Built target HelloWorld _______________________________________________ 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
