Environment:
LLVM/Clang version: r257392
CUDA 7.0
Ubuntu 14.04
The axpy code can be found at http://llvm.org/docs/CompileCudaWithLLVM.html. I also tried the matrixMul in CUDA samples, and saw similar errors. I haven’t tried CUDA 7.5, but do we assume CUDA 7.5 only?
Below is the command line I use and the error messages I got:
In file included from :614:
In file included from :1:
/usr/local/google/home/jingyue/Work/llvm/install-git/bin/…/lib/clang/3.8.0/include/__clang_cuda_runtime_wrapper.h:169:31: error: redefinition of ‘__brkpt’
static inline device void __brkpt(int c) { __brkpt(); }
^
/usr/local/google/home/jingyue/Work/llvm/install-git/bin/…/lib/clang/3.8.0/include/cuda_runtime.h:132:31: note: previous definition is here
static inline device void __brkpt(int c) { __brkpt(); }
^
In file included from :614:
In file included from :1:
In file included from /usr/local/google/home/jingyue/Work/llvm/install-git/bin/…/lib/clang/3.8.0/include/__clang_cuda_runtime_wrapper.h:181:
/usr/local/cuda/include/device_functions.hpp:79:38: error: redefinition of ‘mulhi’ DEVICE_FUNCTIONS_STATIC_DECL int mulhi(int a, int b)
^
/usr/local/cuda/include/device_functions.hpp:79:38: note: previous definition is here DEVICE_FUNCTIONS_STATIC_DECL int mulhi(int a, int b)
^
In file included from :614:
In file included from :1:
In file included from /usr/local/google/home/jingyue/Work/llvm/install-git/bin/…/lib/clang/3.8.0/include/__clang_cuda_runtime_wrapper.h:181:
/usr/local/cuda/include/device_functions.hpp:84:47: error: redefinition of ‘mulhi’ DEVICE_FUNCTIONS_STATIC_DECL unsigned int mulhi(unsigned int a, unsigned int b)
^
/usr/local/cuda/include/device_functions.hpp:84:47: note: previous definition is here DEVICE_FUNCTIONS_STATIC_DECL unsigned int mulhi(unsigned int a, unsigned int b)
ignoring duplicate directory “/usr/lib/gcc/x86_64-linux-gnu/4.8/…/…/…/…/include/c++/4.8/backward” [343/9788]
ignoring duplicate directory “/usr/local/include”
ignoring duplicate directory “/usr/local/google/home/jingyue/Work/llvm/install-git/bin/…/lib/clang/3.8.0/include”
ignoring duplicate directory “/usr/include” #include “…” search starts here: #include <…> search starts here:
/usr/local/cuda
/usr/lib/gcc/x86_64-linux-gnu/4.8/…/…/…/…/include/c++/4.8
/usr/lib/gcc/x86_64-linux-gnu/4.8/…/…/…/…/include/x86_64-linux-gnu/c++/4.8
/usr/lib/gcc/x86_64-linux-gnu/4.8/…/…/…/…/include/c++/4.8/backward
/usr/local/include
/usr/local/google/home/jingyue/Work/llvm/install-git/bin/…/lib/clang/3.8.0/include
/usr/include
/usr/local/cuda/include
End of search list.
In file included from :614:
In file included from :1:
/usr/local/google/home/jingyue/Work/llvm/install-git/bin/…/lib/clang/3.8.0/include/__clang_cuda_runtime_wrapper.h:169:31: error: redefinition of ‘__brkpt’
static inline device void __brkpt(int c) { __brkpt(); }
^
/usr/local/google/home/jingyue/Work/llvm/install-git/bin/…/lib/clang/3.8.0/include/cuda_runtime.h:132:31: note: previous definition is here
static inline device void __brkpt(int c) { __brkpt(); }
^
In file included from :614:
In file included from :1:
In file included from /usr/local/google/home/jingyue/Work/llvm/install-git/bin/…/lib/clang/3.8.0/include/__clang_cuda_runtime_wrapper.h:181:
/usr/local/cuda/include/device_functions.hpp:79:38: error: redefinition of ‘mulhi’ DEVICE_FUNCTIONS_STATIC_DECL int mulhi(int a, int b)
^
/usr/local/cuda/include/device_functions.hpp:79:38: note: previous definition is here DEVICE_FUNCTIONS_STATIC_DECL int mulhi(int a, int b)
^
In file included from :614:
In file included from :1:
In file included from /usr/local/google/home/jingyue/Work/llvm/install-git/bin/…/lib/clang/3.8.0/include/__clang_cuda_runtime_wrapper.h:181:
/usr/local/cuda/include/device_functions.hpp:84:47: error: redefinition of ‘mulhi’ DEVICE_FUNCTIONS_STATIC_DECL unsigned int mulhi(unsigned int a, unsigned int b)
^
/usr/local/cuda/include/device_functions.hpp:84:47: note: previous definition is here DEVICE_FUNCTIONS_STATIC_DECL unsigned int mulhi(unsigned int a, unsigned int b)
Ah! You’ve got a stale cuda_runtime.h in your build directory which gets picked up before the real cuda_runtime.h
/usr/local/google/home/jingyue/Work/llvm/install-git/bin/…/lib/clang/3.8.0/include/cuda_runtime.h:132:31: note: previous definition is here
static inline device void __brkpt(int c) { __brkpt(); }
Remove clang/3.8.0/include from your build directory and try again.