<div dir="ltr">Okay I have opened an issue on CMake for handling multiple gencode with multiple code targets.</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 6, 2017 at 3:19 PM, Mueller-Roemer, Johannes Sebastian <span dir="ltr"><<a href="mailto:Johannes.Sebastian.Mueller-Roemer@igd.fraunhofer.de" target="_blank">Johannes.Sebastian.Mueller-Roemer@igd.fraunhofer.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Yes<br>
<br>
______________________________<wbr>__<br>
From: Robert Maynard [<a href="mailto:robert.maynard@kitware.com">robert.maynard@kitware.com</a>]<br>
Sent: Wednesday, September 06, 2017 6:58 PM<br>
To: Mueller-Roemer, Johannes Sebastian<br>
<span class="">Cc: <a href="mailto:cmake@cmake.org">cmake@cmake.org</a><br>
Subject: Re: [CMake] CMake 3.9.x Visual Studio CUDA PDB/compiler flags issues<br>
<br>
</span><span class="">So it works when they are separate gen-code options, but fails when they are combined. Is that correct?<br>
<br>
<br>
</span><span class="">On Wed, Sep 6, 2017 at 11:16 AM, Mueller-Roemer, Johannes Sebastian <<a href="mailto:Johannes.Sebastian.Mueller-Roemer@igd.fraunhofer.de">Johannes.Sebastian.Mueller-<wbr>Roemer@igd.fraunhofer.de</a><<wbr>mailto:<a href="mailto:Johannes.Sebastian.Mueller-Roemer@igd.fraunhofer.de">Johannes.Sebastian.<wbr>Mueller-Roemer@igd.fraunhofer.<wbr>de</a>>> wrote:<br>
The long form fills the Code Generation field with compute_20,sm_20;compute_20,<wbr>compute_20 (the default without gencode parameters is compute_20,sm_20) and results in the following command line:<br>
<br>
</span>D:\jsroemer\projects\cuda-pdb-<wbr>test\build\a>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin\nvcc.<wbr>exe" -gencode=arch=compute_20,code=<wbr>\"sm_20,compute_20\" -gencode=arch=compute_20,code=<wbr>\"compute_20,compute_20\" --use-local-env --cl-version 2015 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64"  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include"  -G   --keep-dir x64\Debug -maxrregcount=0  --machine 64 --compile -cudart static -Xcompiler="/EHsc -Zi -Ob0" -g   -D_WINDOWS -Xcompiler "/EHsc /W3 /nologo /Od /FS /Zi /RTC1 /MDd /GR" -o A.dir\Debug\a.cu.obj "D:\jsroemer\projects\cuda-<wbr>pdb-test\a\<a href="http://a.cu" rel="noreferrer" target="_blank">a.cu</a><<a href="http://a.cu" rel="noreferrer" target="_blank">http://a.cu</a>>"<br>
<span class=""><br>
Which is somewhat redundant<br>
<br>
MSVC turns compute_20,sm_20 into -gencode=arch=compute_20,code=<wbr>\"sm_20,compute_20\" and compute_20,compute_20 into -gencode=arch=compute_20,code=<wbr>\"compute_20,compute_20\"<br>
<br>
<br>
Fraunhofer-Institut für Graphische Datenverarbeitung IGD<br>
Fraunhoferstr. 5  |  64283 Darmstadt  |  Germany<br>
</span>Tel <a href="tel:%2B49%206151%20155-606" value="+496151155606">+49 6151 155-606</a><tel:+49%206151%20155606>  |  Fax <a href="tel:%2B49%206151%20155-139" value="+496151155139">+49 6151 155-139</a><tel:+49%206151%20155139><br>
<a href="mailto:johannes.mueller-roemer@igd.fraunhofer.de">johannes.mueller-roemer@igd.<wbr>fraunhofer.de</a><mailto:<a href="mailto:johannes.mueller-roemer@igd.fraunhofer.de">johannes.<wbr>mueller-roemer@igd.fraunhofer.<wbr>de</a>> | <a href="http://www.igd.fraunhofer.de" rel="noreferrer" target="_blank">www.igd.fraunhofer.de</a><<a href="http://www.igd.fraunhofer.de" rel="noreferrer" target="_blank">http://<wbr>www.igd.fraunhofer.de</a>><br>
<br>
From: Robert Maynard [mailto:<a href="mailto:robert.maynard@kitware.com">robert.maynard@<wbr>kitware.com</a><mailto:<a href="mailto:robert.maynard@kitware.com">robert.<wbr>maynard@kitware.com</a>>]<br>
<span class="">Sent: Wednesday, September 6, 2017 16:44<br>
<br>
</span>To: Mueller-Roemer, Johannes Sebastian <<a href="mailto:Johannes.Sebastian.Mueller-Roemer@igd.fraunhofer.de">Johannes.Sebastian.Mueller-<wbr>Roemer@igd.fraunhofer.de</a><<wbr>mailto:<a href="mailto:Johannes.Sebastian.Mueller-Roemer@igd.fraunhofer.de">Johannes.Sebastian.<wbr>Mueller-Roemer@igd.fraunhofer.<wbr>de</a>>><br>
Cc: <a href="mailto:cmake@cmake.org">cmake@cmake.org</a><mailto:<a href="mailto:cmake@cmake.org">cmake@<wbr>cmake.org</a>><br>
<span class="">Subject: Re: [CMake] CMake 3.9.x Visual Studio CUDA PDB/compiler flags issues<br>
<br>
Yes I was responding to comment 3.<br>
<br>
I am curious, does the longer form signature "-gencode arch=compute_20,code=sm_20  -gencode arch=compute_20,code=compute_<wbr>20" work correctly? CMake has to parse the gencode flags and move them to special msbuild entries, and I wonder if there is a bug when parsing multiple code options.<br>
<br>
</span><span class="">On Wed, Sep 6, 2017 at 10:36 AM, Mueller-Roemer, Johannes Sebastian <<a href="mailto:Johannes.Sebastian.Mueller-Roemer@igd.fraunhofer.de">Johannes.Sebastian.Mueller-<wbr>Roemer@igd.fraunhofer.de</a><<wbr>mailto:<a href="mailto:Johannes.Sebastian.Mueller-Roemer@igd.fraunhofer.de">Johannes.Sebastian.<wbr>Mueller-Roemer@igd.fraunhofer.<wbr>de</a>>> wrote:<br>
If the comment is wrt 3., the result is the same no matter if I use a space or an equals sign, if I double escape the quotes (e.g., use the value as you wrote it in the cmake-gui for CMAKE_CUDA_FLAGS), the value in VS becomes compute_20,"sm_20,compute_20" instead of compute_20,sm_20,compute_20, which is equally illegal and will cause the same error message, also double escaping should not be necessary for a subset of flags (Xcompiler works fine without it, even if the default values are pointless).<br>
If the comment is wrt 2., this is the line automatically generated by CMake/VS when not passing in any gencode flags explicitly.<br>
<br>
Or am I misunderstanding what you mean?<br>
<br>
Fraunhofer-Institut für Graphische Datenverarbeitung IGD<br>
Fraunhoferstr. 5  |  64283 Darmstadt  |  Germany<br>
</span>Tel <a href="tel:%2B49%206151%20155-606" value="+496151155606">+49 6151 155-606</a><tel:+49%206151%20155606>  |  Fax <a href="tel:%2B49%206151%20155-139" value="+496151155139">+49 6151 155-139</a><tel:+49%206151%20155139><br>
<a href="mailto:johannes.mueller-roemer@igd.fraunhofer.de">johannes.mueller-roemer@igd.<wbr>fraunhofer.de</a><mailto:<a href="mailto:johannes.mueller-roemer@igd.fraunhofer.de">johannes.<wbr>mueller-roemer@igd.fraunhofer.<wbr>de</a>> | <a href="http://www.igd.fraunhofer.de" rel="noreferrer" target="_blank">www.igd.fraunhofer.de</a><<a href="http://www.igd.fraunhofer.de" rel="noreferrer" target="_blank">http://<wbr>www.igd.fraunhofer.de</a>><br>
<br>
From: Robert Maynard [mailto:<a href="mailto:robert.maynard@kitware.com">robert.maynard@<wbr>kitware.com</a><mailto:<a href="mailto:robert.maynard@kitware.com">robert.<wbr>maynard@kitware.com</a>>]<br>
<span class="">Sent: Wednesday, September 6, 2017 15:38<br>
</span>To: Mueller-Roemer, Johannes Sebastian <<a href="mailto:Johannes.Sebastian.Mueller-Roemer@igd.fraunhofer.de">Johannes.Sebastian.Mueller-<wbr>Roemer@igd.fraunhofer.de</a><<wbr>mailto:<a href="mailto:Johannes.Sebastian.Mueller-Roemer@igd.fraunhofer.de">Johannes.Sebastian.<wbr>Mueller-Roemer@igd.fraunhofer.<wbr>de</a>>><br>
Cc: <a href="mailto:cmake@cmake.org">cmake@cmake.org</a><mailto:<a href="mailto:cmake@cmake.org">cmake@<wbr>cmake.org</a>><br>
<span class="">Subject: Re: [CMake] CMake 3.9.x Visual Studio CUDA PDB/compiler flags issues<br>
<br>
As far as gencode goes, your line has errors. With CUDA 8 it should look like:<br>
<br>
-gencode arch=compute_20,code=\"sm_20,<wbr>compute_20\"<br>
<br>
<br>
<br>
</span><span class="">On Mon, Sep 4, 2017 at 4:06 AM, Mueller-Roemer, Johannes Sebastian <<a href="mailto:Johannes.Sebastian.Mueller-Roemer@igd.fraunhofer.de">Johannes.Sebastian.Mueller-<wbr>Roemer@igd.fraunhofer.de</a><<wbr>mailto:<a href="mailto:Johannes.Sebastian.Mueller-Roemer@igd.fraunhofer.de">Johannes.Sebastian.<wbr>Mueller-Roemer@igd.fraunhofer.<wbr>de</a>>> wrote:<br>
I’m having two issues with debug symbols for CUDA libraries on a project:<br>
<br>
<br>
1.       The PDBs are not placed where the linker later expects to find them (haven’t been able to replicate this in a minimal project yet)<br>
<br>
2.       Trying to circumnavigate this issue by using “/Z7” instead of “/Zi” does not work, Zi is always used (replicable in any project with CUDA)<br>
<br>
Replication steps: Replace -Zi or /Zi in CMAKE_*_FLAGS* (CUDA, CXX, C) by -Z7 or /Z7. Build and see several warnings like “cl : Command line warning D9025: overriding '/Z7' with '/Zi'” in the output window.<br>
And do the flags in the –Xcompiler make sense at all in VS? The CUDA build tools seem to determine these automatically anyways… for example I get the following call in the above scenario:<br>
<br>
</span>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin\nvcc.<wbr>exe" -gencode=arch=compute_20,code=<wbr>\"sm_20,compute_20\" --use-local-env --cl-version 2015 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64"  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include"  -G   --keep-dir x64\Debug -maxrregcount=0  --machine 64 --compile -cudart static -Xcompiler="/EHsc -Z7 -Ob0" -g   -D_WINDOWS -Xcompiler "/EHsc /W3 /nologo /Od /FS /Zi /RTC1 /MDd /GR" -o A.dir\Debug\a.cu.obj "D:\jsroemer\projects\cuda-<wbr>pdb-test\a\<a href="http://a.cu" rel="noreferrer" target="_blank">a.cu</a><<a href="http://a.cu" rel="noreferrer" target="_blank">http://a.cu</a>>"<br>
<span class=""><br>
3.       Also, -gencode flags do not behave as expected when given in the form -gencode=arch=compute_20,code=<wbr>"sm_20,compute_20", as this causes the VS build system to error out:<br>
<br>
</span>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\<wbr>v4.0\V140\BuildCustomizations\<wbr>CUDA 8.0.targets(216,9): error : Item '..\..\a\<a href="http://a.cu" rel="noreferrer" target="_blank">a.cu</a><<a href="http://a.cu" rel="noreferrer" target="_blank">http://a.cu</a>>' Code Generation value is not in the expected format '[Arch],[Code]'.<br>
<span class=""><br>
The code generation value in this example is set to compute_20,sm_20,compute_20 by CMake.<br>
<br>
Fraunhofer-Institut für Graphische Datenverarbeitung IGD<br>
Fraunhoferstr. 5  |  64283 Darmstadt  |  Germany<br>
</span>Tel <a href="tel:%2B49%206151%20155-606" value="+496151155606">+49 6151 155-606</a><tel:+49%206151%20155606>  |  Fax <a href="tel:%2B49%206151%20155-139" value="+496151155139">+49 6151 155-139</a><tel:+49%206151%20155139><br>
<a href="mailto:johannes.mueller-roemer@igd.fraunhofer.de">johannes.mueller-roemer@igd.<wbr>fraunhofer.de</a><mailto:<a href="mailto:johannes.mueller-roemer@igd.fraunhofer.de">johannes.<wbr>mueller-roemer@igd.fraunhofer.<wbr>de</a>> | <a href="http://www.igd.fraunhofer.de" rel="noreferrer" target="_blank">www.igd.fraunhofer.de</a><<a href="http://www.igd.fraunhofer.de" rel="noreferrer" target="_blank">http://<wbr>www.igd.fraunhofer.de</a>><br>
<br>
<br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><<a href="http://www.kitware.com" rel="noreferrer" target="_blank">http://www.<wbr>kitware.com</a>><br>
<div class="HOEnZb"><div class="h5"><br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/<wbr>CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/cmake</a><br>
<br>
<br>
<br>
</div></div></blockquote></div><br></div>