How To Compile CUDA Code With LLVM

Written by Michael Larabel in LLVM on 11 November 2015 at 09:00 AM EST. Add A Comment
LLVM
If you have been wondering how to compile CUDA C/C++ code with LLVM rather than NVIDIA's nvcc compiler, an official guide has been written.

The new document explains how to compile CUDA with LLVM and for researchers/developers wanting to improve LLVM on GPUs. Building CUDA codes with LLVM/Clang still currently requires one out-of-tree patch, still obviously requires the CUDA driver/runtime from NVIDIA Corp, and setting various Clang arguments for generating the NVPTX code to then be consumed by NVIDIA's driver stack. The guide also covers some basic optimizations too.

If you want to take a look at the guide for compiling CUDA with LLVM, the document landed in Git.

The CUDA/NVPTX support in LLVM is getting into quite good shape. Google engineers even have been able to use LLVM to make faster CUDA code than NVIDIA's own NVCC compiler. In the GCC world there continues to be Code Sourcery still working on the NVPTX support there too and making OpenACC 2.0 work for NVIDIA GPUs on that compiler with less of a focus on CUDA.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week