[CMake] FindCUDA with ITK

James Bigler jamesbigler at gmail.com
Fri Jan 8 12:11:35 EST 2010


On Thu, Jan 7, 2010 at 8:52 PM, Luke Parkinson <lparkinson at vpac.org> wrote:

> ----- "James Bigler" <jamesbigler at gmail.com> wrote:
> > On Wed, Jan 6, 2010 at 11:00 PM, Luke Parkinson <lparkinson at vpac.org>wrote:
> >
> >
>>
>> Hello Everyone,
>> >
>> > I apologise in advance if this is the wrong way to revive an old topic,
>> but I wasn't sure how to reply to old threads in the mailing list and I'm
>> new to this list.  I'm part of a team of developers looking at integrating
>> CUDA into the Insight Toolkit (http://www.itk.org/). People subscribing
>> to the mailing list over there might have heard from my colleague.
>> >
>> > Thanks to James Bigler and his FindCUDA.cmake module, we have been able
>> to get CUDA and ITK to link into the executable, but we're having a similar
>> problem to the previous post (included below just in case).  I have created
>> several 'build environments' using this module with my own modifications
>> that include the SDK (as an aside, can anyone point me in the direction of
>> code that integrates C++ and CUDA without using cutil.h or cutil_inline.h?).
>>  It works brilliantly with just the CUDA SDK, and the SDK plus our own C++
>> CUDA utility programs, but when we include the ITK in the configuration,
>> building gives errors exactly like those above.  I've attached my
>> modifications to the FindCUDA.cmake module (with a diff), and the
>> 'CMakeLists.txt's we're using in the root and source directories.
>> >
>> > We got the original FindCUDA.cmake from the svn repository, and based
>> our code on the driver examples. When we add our own CUDA/C++ code (files
>> omitted as code is still under development, permission is required), we get
>> the same errors as mentioned previously, along the lines of 'warning:
>> comparison between signed and unsigned integer expressions'.
>> >
>> >
>
> Just including ITK (without our own code, using the provided driver code
>> examples)
>> > [Attached the corresponding files as ITKOnly_FindCUDA.cmake,
>> ITKOnly_root_CMakeLists.txt, ITKOnly_src_CMakeLists.txt]
>> >
>> > Any ideas or suggestions would be helpful.  This isn't crippling (only
>> warnings), but it is annoying and could lead to problems later on if it has
>> to do with how the CMake module deals with C/C++ code.  I also noticed with
>> that same module that there are a few variables that don't seem to do
>> anything.  The example I found was CUDA_INCLUDE_DIRECTORIES (deprecated by
>> CUDA_INCLUDE_DIRS?).  I assume that svn version was the most up-to-date,
>> please let me know if I am wrong.
>> >
>
>
> > snip...
> >
> > What versions of CUDA are you using?  2.3 or a 3.0 beta?
> >
> > Also, could you send the output of 'make VERBOSE=1' with
> CUDA_NVCC_FLAGS=-v for a single object compilation that has these warning?
> I would like to determine at which point these flags are causing problems.
> >
> > You could also attach (if possible) the cmake build script that is
> invoked by FindCUDA for the same object?
> >
> > Also, please make sure that CUDA_HOST_COMPILATION_CPP is ON (this can
> also be verified by me with the cuda_compile....cmake file you can attach).
> >
> > There is also the CUDA_PROPAGATE_HOST_FLAGS that you could turn off, if
> you wish to manage all the host flag propagation manually by using the
> OPTION -Xcompiler combination.
> >
> > James
> >
> The CMake build script is identicle to the others I posted, just different
> source files and executable names.  I included it anyway though, in case
> there was something I missed.  I also double-checked the
> CUDA_HOST_COMPILATION flag, it's definitely set to 1.  If you still think it
> would help, where can I find cuda_compile.cmake?
>
> I've attached the complete 'make VERBOSE=1' for both the FindCUDA.cmake
> sample code, and one with some of the warnings we've been getting for our
> own code.  The CMakeCache.txt is from the ITK build I'm using, so you can
> see some of the variables it had defined internally.  If you've seen the
> CMakeLists.txt I sent yesterday, it includes an ITK file USE_ITK_FILE (it's
> just in the recommendded build, points to the attached UseITK.cmake), which
> is where the new compile flags are introduced.
>
> Thanks for the tip about the CUDA_PROPAGATE_HOST_FLAGS and OPTION
> -Xcompiler, I'll try it out if all else fails. And thanks for the quick
> reply and you help with this,
>
> Luke
>
>
>
Thanks.  If it's possible, I need the output after adding the -v argument to
the CUDA_NVCC_FLAGS.  This will show all the compilation steps from nvcc and
then we can see what commands nvcc is passing to the compiler as well as
what source files its using.

Also, does it produce the warning when you don't specify -Wall?  You may be
able to suppress this flag with a -Wno-all for CUDA code.

The cuda_compile.cmake file I talked about is part of the build system.
Each CUDA file generates its own compilation script which is then invoked by
the build system.  The one for test_bin.cu in the svn test system should be
found here:

build/src/CMakeFiles/cuda_compile_generated_test_bin.cu.obj.cmake

This file contains all the parameters (well most of them) that are used to
compile the CUDA file.  You don't have to send it to me now.  I can see what
I need to from the verbose output.

Thanks,
James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100108/27b393e6/attachment.htm>


More information about the CMake mailing list