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