<div class="gmail_quote">On Mon, Aug 16, 2010 at 11:12 AM, Brian Davis <span dir="ltr">&lt;<a href="mailto:bitminer@gmail.com">bitminer@gmail.com</a>&gt;</span> wrote:<br><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"><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;">--snip--<div><br>Ah you&#39;re on windows, make sure that you deselect the option to<br>



associate the build rule with cu files as this does the wrong thing<br>
when you&#39;re compiling the same file multiple times with different<br>
defines.<br></div>--end snip--<br><br>Can you give me more info on this?  I have looked in CMake variables using search in CMake GUI, and googled on the web snippets of your text, but I did not find anything.  I&#39;ll keep looking.<font color="#888888"></font><br>



</blockquote></div><br></div></div>Ok so I got back to having to resolve this issue and I found the reference you made to &quot;associating the build rules&quot; in the CMake Manual Cuda section <a href="http://www.cmake.org/cmake/help/cmake-2-8-docs.html#module:FindCUDA" target="_blank">http://www.cmake.org/cmake/help/cmake-2-8-docs.html#module:FindCUDA</a>.  The flag in question is CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE which is documented as follows<br>


<br>--snip--<br>  CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE (Default ON)<br>  -- Set to ON if you want the custom build rule to be attached to the source<br>     file in Visual Studio.  Turn OFF if you add the same cuda file to multiple<br>


     targets.<br><br><br>     This allows the user to build the target from the CUDA file; however, bad<br>     things can happen if the CUDA source file is added to multiple targets.<br>     When performing parallel builds it is possible for the custom build<br>


     command to be run more than once and in parallel causing cryptic build<br>     errors.  VS runs the rules for every source file in the target, and a<br>     source can have only one rule no matter how many projects it is added to.<br>


     When the rule is run from multiple targets race conditions can occur on<br>     the generated file.  Eventually everything will get built, but if the user<br>     is unaware of this behavior, there may be confusion.  It would be nice if<br>


     this script could detect the reuse of source files across multiple targets<br>     and turn the option off for the user, but no good solution could be found.<br>--end snip--<br><br>The bits about parallel builds, cryptic build errors, and bad things happening make me uneasy. <br>


<br>This does have an effect on my build, but not the one desired.   What I end up with is now both GPU_RECON and CPU_RECON defined for each project not simply the first, GPU_RECON, as before.<br><br>--snip--<br>C:/CUDA/bin64/nvcc.exe C:/Users/bdavis5/Documents/QS/QS-NIH/source/branches/trunk/source/Matlab/lib/3rdParty/Siemens/gpu/PMatrixRecon/gpuPMatrixRecon.cu -arch sm_13 --ptxas-options=-v -maxrregcount=32 -Xcompiler /EHsc,/W3,/nologo,/Od,/Zi,/MTd -m64 -DgpuReconPlugin_EXPORTS=yes -DGPU_RECON=yes -DCUDADeviceProperties_DLLExport=yes -DGPU_RECON=yes -DCUDADeviceProperties_DLLExport=yes -DCPU_RECON=yes -DcpuPMatrixRecon_EXPORTS -ccbin &quot;c:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin&quot; -DNVCC -M -o C:/Users/bdavis5/Documents/QS/QS-NIH/source/branches/trunk/build/dvip4-Win64/source/Matlab/lib/3rdParty/Siemens/gpu/PMatrixRecon/CMakeFiles/cpuPMatrixRecon_generated_gpuPMatrixRecon.cu.obj.NVCC-depend -IC:/CUDA/include -IC:/Users/bdavis5/Documents/QS/QS-NIH/source/branches/trunk/source/cpp/lib/3rdParty/Win/boost-cmake-1_41_0 &quot;-IC:/ProgramData/NVIDIA Corporation/NVIDIA GPU Computing SDK/C/common/inc&quot; -IC:/Users/bdavis5/Documents/QS/QS-NIH/source/branches/trunk/build/Windows-6.0/install/include/vtk-5.6 -IC:/Users/bdavis5/Documents/QS/QS-NIH/source/branches/trunk/build/Windows-6.0/install/include/VTKEdge &quot;-IC:/Program Files/MATLAB/R2010a/extern/include&quot; -IC:/Users/bdavis5/Documents/QS/QS-NIH/source/branches/trunk/source/Matlab/lib/3rdParty/Siemens/gpu/PMatrixRecon/. -IC:/CUDA/include<br>


--end snip--<br><br>Note the <br>--snip--<br> -DgpuReconPlugin_EXPORTS=yes -DGPU_RECON=yes 
-DCUDADeviceProperties_DLLExport=yes -DGPU_RECON=yes 
-DCUDADeviceProperties_DLLExport=yes -DCPU_RECON=yes -DcpuPMatrixRecon<br>--end snip<br><br>It appears as though CMake keeps tacking on the the compile flags for CU and other targets of which there are three targets in this directory.  Maybe I need multiple directories for each target ugh!  or a new build tool.<br>


<br>Though this is a step I am not sure it is in the right direction. <br><br>Thanks for the lead though it was worth a try.<br></blockquote><div><br>I&#39;m the author of FindCUDA.cmake.  Let me see if I can help you out with some things.<br>

<br>1. CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE can really only cause problems with parallel builds.  Are you performing parallel builds?<br>2. Have you tried to disable this flag? <br></div></div><br>