Xipeng Shen via llvm-dev
2017-Aug-02 20:12 UTC
[llvm-dev] CUDA compilation "No available targets are compatible with this triple." problem
Yes, I followed the guide. The same error showed up:>clang++ axpy.cu -o axpy --cuda-gpu-arch=sm_35 -L/usr/local/cuda/lib64 -I/usr/local/cuda/include -lcudart_static -ldl -lrt -pthreaderror: unable to create target: 'No available targets are compatible with this triple.' ________________________________ From: Kevin Choi <code.kchoi at gmail.com> Sent: Wednesday, August 2, 2017 3:44 PM To: Xipeng Shen Cc: llvm-dev at lists.llvm.org Subject: Re: [llvm-dev] CUDA compilation "No available targets are compatible with this triple." problem I'm assuming you are following guide at https://llvm.org/docs/CompileCudaWithLLVM.html#compiling-cuda-code Compiling CUDA with clang — LLVM 6 documentation<https://llvm.org/docs/CompileCudaWithLLVM.html#compiling-cuda-code> llvm.org 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 ... Have you tried -L and -l flags? Kevin On Wed, Aug 2, 2017 at 2:23 PM, Xipeng Shen via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote: Hi, I have trouble compiling CUDA code with Clang. The following is a command I tried:> clang++ axpy.cu<http://axpy.cu> -o axpy --cuda-gpu-arch=sm_35 --cuda-path=/usr/local/cudaThe error message is error: unable to create target: 'No available targets are compatible with this triple.' The info of the LLVM I'm using is as follows:> lang++ --versionclang version 6.0.0 (http://llvm.org/git/clang.git 16a0981eccf1bfcc9ba928747aa825e8948791cd) (http://llvm.org/git/llvm.git 052dd78cb30f77a05dc8bb06b851402c4b6c6587) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /home/xshen5/llvm/bin Registered Targets: x86 - 32-bit X86: Pentium-Pro and above x86-64 - 64-bit X86: EM64T and AMD64 Any help I could get? Thanks! -Xin _______________________________________________ LLVM Developers mailing list llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170802/0c387922/attachment.html>
Pierre Moreau via llvm-dev
2017-Aug-02 22:45 UTC
[llvm-dev] CUDA compilation "No available targets are compatible with this triple." problem
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. Pierre> On 2 Aug 2017, at 13:12, Xipeng Shen via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Yes, I followed the guide. The same error showed up: > > > >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 > error: unable to create target: 'No available targets are compatible with this triple.' > > > > From: Kevin Choi <code.kchoi at gmail.com> > Sent: Wednesday, August 2, 2017 3:44 PM > To: Xipeng Shen > Cc: llvm-dev at lists.llvm.org > Subject: Re: [llvm-dev] CUDA compilation "No available targets are compatible with this triple." problem > > I'm assuming you are following guide at https://llvm.org/docs/CompileCudaWithLLVM.html#compiling-cuda-code > Compiling CUDA with clang ― LLVM 6 documentation > llvm.org > 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 ... > > > Have you tried -L and -l flags? > > Kevin > >> On Wed, Aug 2, 2017 at 2:23 PM, Xipeng Shen via llvm-dev <llvm-dev at lists.llvm.org> wrote: >> Hi, >> >> >> >> I have trouble compiling CUDA code with Clang. The following is a command I tried: >> >> >> >> > clang++ axpy.cu -o axpy --cuda-gpu-arch=sm_35 --cuda-path=/usr/local/cuda >> >> >> The error message is >> >> >> >> error: unable to create target: 'No available targets are compatible with this triple.' >> >> >> >> The info of the LLVM I'm using is as follows: >> >> > lang++ --version >> clang version 6.0.0 (http://llvm.org/git/clang.git 16a0981eccf1bfcc9ba928747aa825e8948791cd) (http://llvm.org/git/llvm.git 052dd78cb30f77a05dc8bb06b851402c4b6c6587) >> Target: x86_64-unknown-linux-gnu >> Thread model: posix >> InstalledDir: /home/xshen5/llvm/bin >> >> Registered Targets: >> x86 - 32-bit X86: Pentium-Pro and above >> x86-64 - 64-bit X86: EM64T and AMD64 >> >> Any help I could get? Thanks! >> >> >> -Xin >> >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170802/e78994fb/attachment.html>
Xipeng Shen via llvm-dev
2017-Aug-03 11:12 UTC
[llvm-dev] CUDA compilation "No available targets are compatible with this triple." problem
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 cmake ~/clang-llvm/llvm -DCMAKE_BUILD_TYPE=Release -G Ninja -DLLVM_TARGETS_TO_BUILD="X86;NVPTX" The problem was then gone. Thanks! ________________________________ From: Pierre Moreau <pierre.morrow at free.fr> Sent: Wednesday, August 2, 2017 6:45 PM To: Xipeng Shen Cc: llvm-dev at lists.llvm.org Subject: Re: [llvm-dev] CUDA compilation "No available targets are compatible with this triple." problem 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. Pierre On 2 Aug 2017, at 13:12, Xipeng Shen via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote: Yes, I followed the guide. The same error showed up:>clang++ axpy.cu -o axpy --cuda-gpu-arch=sm_35 -L/usr/local/cuda/lib64 -I/usr/local/cuda/include -lcudart_static -ldl -lrt -pthreaderror: unable to create target: 'No available targets are compatible with this triple.' ________________________________ From: Kevin Choi <code.kchoi at gmail.com<mailto:code.kchoi at gmail.com>> Sent: Wednesday, August 2, 2017 3:44 PM To: Xipeng Shen Cc: llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org> Subject: Re: [llvm-dev] CUDA compilation "No available targets are compatible with this triple." problem I'm assuming you are following guide at https://llvm.org/docs/CompileCudaWithLLVM.html#compiling-cuda-code Compiling CUDA with clang — LLVM 6 documentation<https://llvm.org/docs/CompileCudaWithLLVM.html#compiling-cuda-code> llvm.org<http://llvm.org> 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 ... Have you tried -L and -l flags? Kevin On Wed, Aug 2, 2017 at 2:23 PM, Xipeng Shen via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote: Hi, I have trouble compiling CUDA code with Clang. The following is a command I tried:> clang++ axpy.cu<http://axpy.cu> -o axpy --cuda-gpu-arch=sm_35 --cuda-path=/usr/local/cudaThe error message is error: unable to create target: 'No available targets are compatible with this triple.' The info of the LLVM I'm using is as follows:> lang++ --versionclang version 6.0.0 (http://llvm.org/git/clang.git 16a0981eccf1bfcc9ba928747aa825e8948791cd) (http://llvm.org/git/llvm.git 052dd78cb30f77a05dc8bb06b851402c4b6c6587) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /home/xshen5/llvm/bin Registered Targets: x86 - 32-bit X86: Pentium-Pro and above x86-64 - 64-bit X86: EM64T and AMD64 Any help I could get? Thanks! -Xin _______________________________________________ LLVM Developers mailing list llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev _______________________________________________ LLVM Developers mailing list llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170803/278c8533/attachment.html>