<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>That was indeed the reason for the issue. The document of LLVM says that the default setting is all targets, which seems not true. I rebuilt LLVM with </p>
<p><br>
</p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="font-variant-ligatures: no-common-ligatures;">cmake ~/clang-llvm/llvm -DCMAKE_BUILD_TYPE=Release -G Ninja -DLLVM_TARGETS_TO_BUILD="X86;NVPTX"</span></p>
<p></p>
<br>
The problem was then gone.
<div>Thanks!</div>
<div><br>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Pierre Moreau <pierre.morrow@free.fr><br>
<b>Sent:</b> Wednesday, August 2, 2017 6:45 PM<br>
<b>To:</b> Xipeng Shen<br>
<b>Cc:</b> llvm-dev@lists.llvm.org<br>
<b>Subject:</b> Re: [llvm-dev] CUDA compilation "No available targets are compatible with this triple." problem</font>
<div> </div>
</div>
<div>
<div></div>
<div>If I am not mistaken, clang will compile CUDA code to PTX (which is then fed to ptxas), so I would assume you need to have the NVPTX target enabled, which does not seem to be the case for you. </div>
<div><br>
</div>
<div>Pierre</div>
<div><br>
On 2 Aug 2017, at 13:12, Xipeng Shen via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
<br>
</div>
<blockquote type="cite">
<div>
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p>Yes, I followed the guide. The same error showed up:</p>
<p><br>
</p>
<p></p>
<p style="margin:0px; font-style:normal; font-weight:normal; font-size:11px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">>clang++ axpy.cu -o axpy --cuda-gpu-arch=sm_35 -L/usr/local/cuda/lib64 -I/usr/local/cuda/include -lcudart_static -ldl -lrt -pthread</span></p>
<p style="margin:0px; font-style:normal; font-weight:normal; font-size:11px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">error: unable to create target: 'No available targets are compatible with this triple.'</span></p>
<br>
<p></p>
<br>
<div style="color:rgb(0,0,0)">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Kevin Choi <<a href="mailto:code.kchoi@gmail.com">code.kchoi@gmail.com</a>><br>
<b>Sent:</b> Wednesday, August 2, 2017 3:44 PM<br>
<b>To:</b> Xipeng Shen<br>
<b>Cc:</b> <a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<b>Subject:</b> Re: [llvm-dev] CUDA compilation "No available targets are compatible with this triple." problem</font>
<div> </div>
</div>
<div>
<div dir="ltr">I'm assuming you are following guide at <a href="https://llvm.org/docs/CompileCudaWithLLVM.html#compiling-cuda-code" id="LPlnk190980" previewremoved="true">https://llvm.org/docs/CompileCudaWithLLVM.html#compiling-cuda-code</a>
<div id="LPBorder_GT_15017046731850.09696515334718181" style="margin-bottom:20px; overflow:auto; width:100%; text-indent:0px">
<table id="LPContainer_15017046731830.5669925711880981" cellspacing="0" style="width:90%; background-color:rgb(255,255,255); overflow:auto; padding-top:20px; padding-bottom:20px; margin-top:20px; border-top:1px dotted rgb(200,200,200); border-bottom:1px dotted rgb(200,200,200)">
<tbody>
<tr valign="top" style="border-spacing:0px">
<td id="TextCell_15017046731830.19566024209207833" colspan="2" style="vertical-align: top; padding: 0px; display: table-cell; position: relative;">
<div id="LPRemovePreviewContainer_15017046731830.24413493626626637"></div>
<div id="LPTitle_15017046731840.5568645610642271" style="top:0px; color:rgb(0,120,215); font-weight:normal; font-size:21px; font-family:wf_segoe-ui_light,"Segoe UI Light","Segoe WP Light","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; line-height:21px">
<a id="LPUrlAnchor_15017046731840.665396300843432" href="https://llvm.org/docs/CompileCudaWithLLVM.html#compiling-cuda-code" target="_blank" style="text-decoration:none">Compiling CUDA with clang — LLVM 6 documentation</a></div>
<div id="LPMetadata_15017046731840.10739839010407803" style="margin:10px 0px 16px; color:rgb(102,102,102); font-weight:normal; font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size:14px; line-height:14px">
<a href="http://llvm.org">llvm.org</a></div>
<div id="LPDescription_15017046731840.6162967787350699" style="display:block; color:rgb(102,102,102); font-weight:normal; font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size:14px; line-height:20px; max-height:100px; overflow:hidden">
Prerequisites ¶ CUDA is supported in llvm 3.9, but it’s still in active development, so we recommend you compile clang/LLVM from HEAD. Before you build CUDA code ...</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<div><br>
</div>
<div>Have you tried -L and -l flags?</div>
<div><br>
</div>
<div>Kevin</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Wed, Aug 2, 2017 at 2:23 PM, Xipeng Shen via llvm-dev
<span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr">
<div id="m_3280272557772410889divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p><span>Hi,</span></p>
<p><span><br>
</span></p>
<p><span>I have trouble compiling CUDA code with Clang. The following is a command I tried:</span></p>
<p><span><br>
</span></p>
<p><span>> clang++ <a href="http://axpy.cu" target="_blank">axpy.cu</a> -o axpy --cuda-gpu-arch=sm_35 --cuda-path=/usr/local/cuda</span><br>
</p>
<p><span><br>
</span></p>
<p><span>The error message is </span></p>
<p><span><br>
</span></p>
<p><span><span>error: unable to create target: 'No available targets are compatible with this triple.'</span><br>
</span></p>
<p><span><span><br>
</span></span></p>
<p>The info of the LLVM I'm using is as follows:</p>
<p></p>
<p style="margin:0px; font-style:normal; font-weight:normal; font-size:11px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">> lang++ --version</span></p>
<p style="margin:0px; font-style:normal; font-weight:normal; font-size:11px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">clang version 6.0.0 (<a href="http://llvm.org/git/clang.git" target="_blank">http://llvm.org/git/clang.git</a> 16a0981eccf1bfcc9ba928747aa825<wbr>e8948791cd) (<a href="http://llvm.org/git/llvm.git" target="_blank">http://llvm.org/git/llvm.git</a>
052dd78cb30f77a05dc8bb06b85140<wbr>2c4b6c6587)</span></p>
<p style="margin:0px; font-style:normal; font-weight:normal; font-size:11px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">Target: x86_64-unknown-linux-gnu</span></p>
<p style="margin:0px; font-style:normal; font-weight:normal; font-size:11px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">Thread model: posix</span></p>
<p style="margin:0px; font-style:normal; font-weight:normal; font-size:11px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">InstalledDir: /home/xshen5/llvm/bin</span></p>
<p style="margin:0px; font-style:normal; font-weight:normal; font-size:11px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255); min-height:13px">
<span style=""></span><br>
</p>
<p style="margin:0px; font-style:normal; font-weight:normal; font-size:11px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><span class="m_3280272557772410889Apple-converted-space"> </span>
Registered Targets:</span></p>
<p style="margin:0px; font-style:normal; font-weight:normal; font-size:11px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><span class="m_3280272557772410889Apple-converted-space"> </span>
x86<span class="m_3280272557772410889Apple-converted-space"> </span>- 32-bit X86: Pentium-Pro and above</span></p>
<p style="margin:0px; font-style:normal; font-weight:normal; font-size:11px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><span class="m_3280272557772410889Apple-converted-space"> </span>
x86-64 - 64-bit X86: EM64T and AMD64</span></p>
<br>
<p></p>
<p>Any help I could get? Thanks!</p>
<p><br>
</p>
<p>-Xin</p>
</div>
</div>
<br>
______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<blockquote type="cite">
<div><span>_______________________________________________</span><br>
<span>LLVM Developers mailing list</span><br>
<span><a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a></span><br>
<span><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a></span><br>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</body>
</html>