On Sun, Jan 10, 2010 at 3:50 PM, Luke Parkinson <span dir="ltr"><<a href="mailto:lparkinson@vpac.org">lparkinson@vpac.org</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="h5"><br>
----- "James Bigler" <<a href="mailto:jamesbigler@gmail.com">jamesbigler@gmail.com</a>> wrote:<br>
<br>
> On Thu, Jan 7, 2010 at 8:52 PM, Luke Parkinson < <a href="mailto:lparkinson@vpac.org">lparkinson@vpac.org</a> ><br>
> wrote:<br>
><br>
> ----- "James Bigler" < <a href="mailto:jamesbigler@gmail.com">jamesbigler@gmail.com</a> > wrote:<br>
> > On Wed, Jan 6, 2010 at 11:00 PM, Luke Parkinson <<br>
> <a href="mailto:lparkinson@vpac.org">lparkinson@vpac.org</a> > wrote:<br>
> ><br>
> ><br>
><br>
> Hello Everyone,<br>
> ><br>
> > I apologise in advance if this is the wrong way to revive an old<br>
> topic, but I wasn't sure how to reply to old threads in the mailing<br>
> list and I'm new to this list. I'm part of a team of developers<br>
> looking at integrating CUDA into the Insight Toolkit (<br>
> <a href="http://www.itk.org/" target="_blank">http://www.itk.org/</a> ). People subscribing to the mailing list over<br>
> there might have heard from my colleague.<br>
> ><br>
> > Thanks to James Bigler and his FindCUDA.cmake module, we have been<br>
> able to get CUDA and ITK to link into the executable, but we're having<br>
> a similar problem to the previous post (included below just in case).<br>
> I have created several 'build environments' using this module with my<br>
> own modifications that include the SDK (as an aside, can anyone point<br>
> me in the direction of code that integrates C++ and CUDA without using<br>
> cutil.h or cutil_inline.h?). It works brilliantly with just the CUDA<br>
> SDK, and the SDK plus our own C++ CUDA utility programs, but when we<br>
> include the ITK in the configuration, building gives errors exactly<br>
> like those above. I've attached my modifications to the FindCUDA.cmake<br>
> module (with a diff), and the 'CMakeLists.txt's we're using in the<br>
> root and source directories.<br>
> ><br>
> > We got the original FindCUDA.cmake from the svn repository, and<br>
> based our code on the driver examples. When we add our own CUDA/C++<br>
> code (files omitted as code is still under development, permission is<br>
> required), we get the same errors as mentioned previously, along the<br>
> lines of 'warning: comparison between signed and unsigned integer<br>
> expressions'.<br>
> ><br>
> ><br>
><br>
> Just including ITK (without our own code, using the provided driver<br>
> code examples)<br>
> > [Attached the corresponding files as ITKOnly_FindCUDA.cmake,<br>
> ITKOnly_root_CMakeLists.txt, ITKOnly_src_CMakeLists.txt]<br>
> ><br>
> > Any ideas or suggestions would be helpful. This isn't crippling<br>
> (only warnings), but it is annoying and could lead to problems later<br>
> on if it has to do with how the CMake module deals with C/C++ code. I<br>
> also noticed with that same module that there are a few variables that<br>
> don't seem to do anything. The example I found was<br>
> CUDA_INCLUDE_DIRECTORIES (deprecated by CUDA_INCLUDE_DIRS?). I assume<br>
> that svn version was the most up-to-date, please let me know if I am<br>
> wrong.<br>
> ><br>
> > snip...<br>
> ><br>
> > What versions of CUDA are you using? 2.3 or a 3.0 beta?<br>
> ><br>
> > Also, could you send the output of 'make VERBOSE=1' with<br>
> CUDA_NVCC_FLAGS=-v for a single object compilation that has these<br>
> warning? I would like to determine at which point these flags are<br>
> causing problems.<br>
> ><br>
> > You could also attach (if possible) the cmake build script that is<br>
> invoked by FindCUDA for the same object?<br>
> ><br>
> > Also, please make sure that CUDA_HOST_COMPILATION_CPP is ON (this<br>
> can also be verified by me with the cuda_compile....cmake file you can<br>
> attach).<br>
> ><br>
> > There is also the CUDA_PROPAGATE_HOST_FLAGS that you could turn off,<br>
> if you wish to manage all the host flag propagation manually by using<br>
> the OPTION -Xcompiler combination.<br>
> ><br>
> > James<br>
> ><br>
> The CMake build script is identicle to the others I posted, just<br>
> different source files and executable names. I included it anyway<br>
> though, in case there was something I missed. I also double-checked<br>
> the CUDA_HOST_COMPILATION flag, it's definitely set to 1. If you still<br>
> think it would help, where can I find cuda_compile.cmake?<br>
><br>
> I've attached the complete 'make VERBOSE=1' for both the<br>
> FindCUDA.cmake sample code, and one with some of the warnings we've<br>
> been getting for our own code. The CMakeCache.txt is from the ITK<br>
> build I'm using, so you can see some of the variables it had defined<br>
> internally. If you've seen the CMakeLists.txt I sent yesterday, it<br>
> includes an ITK file USE_ITK_FILE (it's just in the recommendded<br>
> build, points to the attached UseITK.cmake), which is where the new<br>
> compile flags are introduced.<br>
><br>
> Thanks for the tip about the CUDA_PROPAGATE_HOST_FLAGS and OPTION<br>
> -Xcompiler, I'll try it out if all else fails. And thanks for the<br>
> quick reply and you help with this,<br>
><br>
> Luke<br>
><br>
><br>
><br>
> Thanks. If it's possible, I need the output after adding the -v<br>
> argument to the CUDA_NVCC_FLAGS. This will show all the compilation<br>
> steps from nvcc and then we can see what commands nvcc is passing to<br>
> the compiler as well as what source files its using.<br>
><br>
> Also, does it produce the warning when you don't specify -Wall? You<br>
> may be able to suppress this flag with a -Wno-all for CUDA code.<br>
><br>
> The cuda_compile.cmake file I talked about is part of the build<br>
> system. Each CUDA file generates its own compilation script which is<br>
> then invoked by the build system. The one for <a href="http://test_bin.cu" target="_blank">test_bin.cu</a> in the svn<br>
> test system should be found here:<br>
><br>
> build/src/CMakeFiles/cuda_compile_generated_test_bin.cu.obj.cmake<br>
><br>
> This file contains all the parameters (well most of them) that are<br>
> used to compile the CUDA file. You don't have to send it to me now. I<br>
> can see what I need to from the verbose output.<br>
><br>
> Thanks,<br>
> James<br>
<br>
The output I attached was produced with the '-v' flag argument added to the CUDA_NVCC_FLAGS variable. If the output is not what you expected, could it be that the ITK variables are overwriting the FindCUDA.cmake flags?<br>
<br>
I tried adding -Wno-all to CUDA_NVCC_FLAGS along with -v, but it wouldn't compile, saying 'unknown flag 'v -w'' or 'v -Wno-all'. I think there's definitely something happening with that variable, because when I added both options to the CMAKE_CXX_FLAGS variable, it worked fine. I'll post the output with just -v in the CMAKE_CXX_FLAGS variable, just in case it helps.<br>
<br>
By itself in the CMAKE_CXX_FLAGS variable, -w suppresses every warning but "cc1: warning: command line option "-Wno-deprecated" is valid for C++/Java/ObjC++ but not for C", and with -Wno-all I get "cc1plus: error: unrecognized command line option "-Wno-all"" with all the old warnings. But that's somewhat helpful, since that means that passing -w in CMAKE_CXX_FLAGS makes it through to nvcc and blocks all the C++ warnings there.<br>
<br>
Hopefully the output I got by putting -v in the CMAKE_CXX_FLAGS variable will help.<br>
<br>
Luke</div></div></blockquote></div><br>This output looks like you put the -v in the CXX flags which isn't what I needed. I needed the -v flag passed to NVCC. You can add the -v flag to CUDA_NVCC_FLAGS from the GUI or ccmake.<br>
<br>Also, -Wno-all is a CXX flag, not a NVCC flag. Adding it to CUDA_NVCC_FLAGS will make NVCC fail as you discovered. If you want to pass the flag to the CXX compiler with a NVCC flag you need to add -Xcompiler;-Wno-all to CUDA_NVCC_FLAGS. The -Xcompiler tells NVCC to pass the next flag to CXX compiler. Alternatively, you could edit the CMAKE_CXX_FLAGS or CMAKE_C_FLAGS to include -Wno-all which would then be automatically passed to nvcc via -Xcompiler.<br>
<br>James<br>