李阳 via llvm-dev
2016-Oct-27 04:59 UTC
[llvm-dev] problem on compiling cuda program with clang++
Hi all, I compiled the *llvm3.9* source code on the *Nvidia TX1* board. And now I am following the document in the docs/CompileCudaWithLLVM.rst to compile cuda program with clang++. However, when I compile `axpy.cu` using `nvcc`, *nvcc* can generate the correct the binary; while compiling `axpy.cu` using clang++, the detailed command is `clang++ axpy.cu -o axpy --cuda-gpu-arch=sm_53 -L/usr/local/cuda/lib64 -lcudart_static -ldl -lrt -pthread`, *clang++* generate the following error:`/usr/include/features.h:367:12: fatal error: 'sys/cdefs.h' file not found # include <sys/cdefs.h>`. And I find that 'sys/cdefs.h' is included in the directory `/usr/include/aarch64-linux-gnu/sys`. Anybody ever came accross the same problems? Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161027/fed98caf/attachment-0001.html>
Justin Lebar via llvm-dev
2016-Oct-27 18:02 UTC
[llvm-dev] problem on compiling cuda program with clang++
Hi, it looks like you're compiling CUDA for an ARM host? This is not a configuration we have tested, nor is it something we have the capability of testing at the moment. You may be able to make it work by providing the appropriate -isystem flags to clang so that it can find your headers, but who knows, it may be more complicated than that. Regards, -Justin On Wed, Oct 26, 2016 at 9:59 PM, 李阳 via llvm-dev <llvm-dev at lists.llvm.org> wrote:> Hi all, > > I compiled the llvm3.9 source code on the Nvidia TX1 board. And now I am > following the document in the docs/CompileCudaWithLLVM.rst to compile cuda > program with clang++. > > However, when I compile `axpy.cu` using `nvcc`, nvcc can generate the > correct the binary; > > while compiling `axpy.cu` using clang++, the detailed command is `clang++ > axpy.cu -o axpy --cuda-gpu-arch=sm_53 -L/usr/local/cuda/lib64 > -lcudart_static -ldl -lrt -pthread`, clang++ generate the following > error:`/usr/include/features.h:367:12: fatal error: 'sys/cdefs.h' file not > found > # include <sys/cdefs.h>`. > > And I find that 'sys/cdefs.h' is included in the directory > `/usr/include/aarch64-linux-gnu/sys`. > > Anybody ever came accross the same problems? Thanks! > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >
Justin Lebar via llvm-dev
2016-Oct-27 19:43 UTC
[llvm-dev] problem on compiling cuda program with clang++
(+llvm-dev) My question was whether your host machine, the one which is running the compiler, is ARM (as opposed to x86 or POWER). The header you pointed to was in "aarch64-linux-gnu", which made me think you might be on an ARM system. If you are not running linux x86, it is not likely to work. If you are running linux x86, we will need much more details about your system in order to be able to assist you. (For example, what Linux distribution are you running, and what version?) We will also need the output of running your command with "clang -v" and the preprocessor output, clang -E. -Justin On Thu, Oct 27, 2016 at 11:49 AM, 李阳 <liyang.cs.cqu at gmail.com> wrote:> Yes, I am following the document `CompileCUDAWithLLVM.rst`. > > And I want to use the `clang++` to compile the CUDA program to generate > intermediate representation(IR). However what I have been trying is that > `nvcc` can compile correctly and `clang++` cannot. > > I dont know whether the `nvcc` can generate the IR code or PTX level > instruction? Thanks! > > 2016-10-28 2:02 GMT+08:00 Justin Lebar <jlebar at google.com>: >> >> Hi, it looks like you're compiling CUDA for an ARM host? This is not >> a configuration we have tested, nor is it something we have the >> capability of testing at the moment. >> >> You may be able to make it work by providing the appropriate -isystem >> flags to clang so that it can find your headers, but who knows, it may >> be more complicated than that. >> >> Regards, >> -Justin >> >> On Wed, Oct 26, 2016 at 9:59 PM, 李阳 via llvm-dev >> <llvm-dev at lists.llvm.org> wrote: >> > Hi all, >> > >> > I compiled the llvm3.9 source code on the Nvidia TX1 board. And now I am >> > following the document in the docs/CompileCudaWithLLVM.rst to compile >> > cuda >> > program with clang++. >> > >> > However, when I compile `axpy.cu` using `nvcc`, nvcc can generate the >> > correct the binary; >> > >> > while compiling `axpy.cu` using clang++, the detailed command is >> > `clang++ >> > axpy.cu -o axpy --cuda-gpu-arch=sm_53 -L/usr/local/cuda/lib64 >> > -lcudart_static -ldl -lrt -pthread`, clang++ generate the following >> > error:`/usr/include/features.h:367:12: fatal error: 'sys/cdefs.h' file >> > not >> > found >> > # include <sys/cdefs.h>`. >> > >> > And I find that 'sys/cdefs.h' is included in the directory >> > `/usr/include/aarch64-linux-gnu/sys`. >> > >> > Anybody ever came accross the same problems? Thanks! >> > >> > >> > _______________________________________________ >> > LLVM Developers mailing list >> > llvm-dev at lists.llvm.org >> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> > > >
Renato Golin via llvm-dev
2016-Oct-27 20:04 UTC
[llvm-dev] problem on compiling cuda program with clang++
On 27 October 2016 at 19:02, Justin Lebar via llvm-dev <llvm-dev at lists.llvm.org> wrote:> Hi, it looks like you're compiling CUDA for an ARM host? This is not > a configuration we have tested, nor is it something we have the > capability of testing at the moment.Hi Justin, NVidia TX1 is the AArch64 Jetson board with proper GPU (we use those).> You may be able to make it work by providing the appropriate -isystem > flags to clang so that it can find your headers, but who knows, it may > be more complicated than that.We don't use them for their GPU, so I don't know, but those kits are meant to be CUDA development boxes. The board setup process has an installer (JetPack) which gets all the drivers, headers and libraires for CUDA development. It should be just a matter of finding them and using with -isystem. cheers, --renato