[cfe-dev] [CUDA] unable to compile the AXPY sample any more

Artem Belevich via cfe-dev cfe-dev at lists.llvm.org
Mon Jan 11 16:02:09 PST 2016


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.

--Artem

On Mon, Jan 11, 2016 at 3:25 PM, Jingyue Wu <jingyue at google.com> wrote:

> clang version 3.8.0 (http://llvm.org/git/clang.git
> d22eccf82560826415ac761375a9ea8bace7c899) (http://llvm.org/git/llvm.git
> d24b395f8b297e6437c00d4fbafeac2e69cdf9b7)       [385/9788]
> Target: x86_64-unknown-linux-gnu
> Thread model: posix
> InstalledDir: /usr/local/google/home/jingyue/Work/llvm/install/bin
> Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.6
> Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.6.4
> Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8
> Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8.4
> Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
> Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.1
> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.4
> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.1
> Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
> Candidate multilib: .;@m64
> Candidate multilib: 32;@m32
> Candidate multilib: x32;@mx32
> Selected multilib: .;@m64
> Found CUDA installation: /usr/local/cuda
>  "/usr/local/google/home/jingyue/Work/llvm/install-git/bin/clang-3.8" -cc1
> -triple nvptx64-nvidia-cuda -aux-triple x86_64-unknown-linux-gnu
> -fcuda-target-overloads -fcuda-disable-ta
> rget-call-checks -S -disable-free -main-file-name axpy.cu
> -mrelocation-model static -mthread-model posix -mdisable-fp-elim
> -fmath-errno -no-integrated-as -mconstructor-aliases -fcud
> a-is-device -mlink-cuda-bitcode
> /usr/local/cuda/nvvm/libdevice/libdevice.compute_20.10.bc -target-feature
> +ptx42 -target-cpu sm_20 -v -dwarf-column-info -debugger-tuning=gdb -resour
> ce-dir
> /usr/local/google/home/jingyue/Work/llvm/install-git/bin/../lib/clang/3.8.0
> -I ../../common/inc -I /usr/local/cuda -internal-isystem
> /usr/lib/gcc/x86_64-linux-gnu/4.8/../../.
> ./../include/c++/4.8 -internal-isystem
> /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8
> -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../..
> /include/x86_64-linux-gnu/c++/4.8 -internal-isystem
> /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/backward
> -internal-isystem /usr/local/include -internal-isystem /us
> r/local/google/home/jingyue/Work/llvm/install-git/bin/../lib/clang/3.8.0/include
> -internal-externc-isystem /include -internal-externc-isystem /usr/include
> -internal-isystem /usr/lib
> /gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8 -internal-isystem
> /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8
> -internal-isystem /usr/lib/gcc
> /x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8
> -internal-isystem
> /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/backward
> -internal-isystem /usr/lo
> cal/cuda/include -include __clang_cuda_runtime_wrapper.h
> -fdeprecated-macro -fno-dwarf-directory-asm -fdebug-compilation-dir
> /usr/local/google/home/jingyue/Work -ferror-limit 19 -fm
> essage-length 181 -pthread -fobjc-runtime=gcc -fcxx-exceptions
> -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
> /tmp/axpy-925ebf.s -x cuda axpy.cu
> clang -cc1 version 3.8.0 based upon LLVM 3.8.0svn default target
> x86_64-unknown-linux-gnu
> ignoring nonexistent directory "../../common/inc"
> ignoring nonexistent directory "/include"
> ignoring duplicate directory
> "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8"
> ignoring duplicate directory
> "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8"
> ignoring duplicate directory
> "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8"
> ignoring duplicate directory
> "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8"
> 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 <built-in>:614:
> In file included from <command line>: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 <built-in>:614:
> In file included from <command line>: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 <built-in>:614:
> In file included from <command line>: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)
>
> On Mon, Jan 11, 2016 at 3:20 PM, Artem Belevich <tra at google.com> wrote:
>
>> Could you add '-v' to command line and send me what it prints on your box?
>>
>>
>>
>> On Mon, Jan 11, 2016 at 3:15 PM, Jingyue Wu <jingyue at google.com> wrote:
>>
>>> 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:
>>>
>>> jingyue Work% clang++ -I../../common/inc -L/usr/local/cuda/lib64
>>> -I/usr/local/cuda axpy.cu -lcudart_static -lcuda -ldl -lrt -pthread
>>>
>>> In file included from <built-in>:614:
>>> In file included from <command line>: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 <built-in>:614:
>>> In file included from <command line>: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 <built-in>:614:
>>> In file included from <command line>: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)
>>>
>>
>>
>>
>> --
>> --Artem Belevich
>>
>
>


-- 
--Artem Belevich
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160111/50acebb0/attachment.html>


More information about the cfe-dev mailing list