<div dir="ltr">Ah! You've got a stale cuda_runtime.h in your build directory which gets picked up before the real cuda_runtime.h<div><br></div><div><div style="color:rgb(80,0,80)">/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</div><div style="color:rgb(80,0,80)">static inline __device__ void __brkpt(int c) { __brkpt(); }</div></div><div><br></div><div>Remove clang/3.8.0/include from your build directory and try again.</div><div><br></div><div>--Artem</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 11, 2016 at 3:25 PM, Jingyue Wu <span dir="ltr"><<a href="mailto:jingyue@google.com" target="_blank">jingyue@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>clang version 3.8.0 (<a href="http://llvm.org/git/clang.git" target="_blank">http://llvm.org/git/clang.git</a> d22eccf82560826415ac761375a9ea8bace7c899) (<a href="http://llvm.org/git/llvm.git" target="_blank">http://llvm.org/git/llvm.git</a> d24b395f8b297e6437c00d4fbafeac2e69cdf9b7) [385/9788]</div><div>Target: x86_64-unknown-linux-gnu</div><div>Thread model: posix</div><div>InstalledDir: /usr/local/google/home/jingyue/Work/llvm/install/bin</div><div>Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.6</div><div>Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.6.4</div><div>Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8</div><div>Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8.4</div><div>Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9</div><div>Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.1</div><div>Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4</div><div>Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7</div><div>Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6</div><div>Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4</div><div>Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8</div><div>Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.4</div><div>Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9</div><div>Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.1</div><div>Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8</div><div>Candidate multilib: .;@m64</div><div>Candidate multilib: 32;@m32</div><div>Candidate multilib: x32;@mx32</div><div>Selected multilib: .;@m64</div><div>Found CUDA installation: /usr/local/cuda</div><div> "/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</div><div>rget-call-checks -S -disable-free -main-file-name <a href="http://axpy.cu" target="_blank">axpy.cu</a> -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -no-integrated-as -mconstructor-aliases -fcud</div><div>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</div><div>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/../../.</div><div>./../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/../../../..</div><div>/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</div><div>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</div><div>/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</div><div>/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</div><div>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</div><div>essage-length 181 -pthread -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/axpy-925ebf.s -x cuda <a href="http://axpy.cu" target="_blank">axpy.cu</a></div><div>clang -cc1 version 3.8.0 based upon LLVM 3.8.0svn default target x86_64-unknown-linux-gnu</div><div>ignoring nonexistent directory "../../common/inc"</div><div>ignoring nonexistent directory "/include"</div><div>ignoring duplicate directory "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8"</div><div>ignoring duplicate directory "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8"</div><div>ignoring duplicate directory "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8"</div><div>ignoring duplicate directory "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8"</div><div><div>ignoring duplicate directory "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/backward" [343/9788]</div><div>ignoring duplicate directory "/usr/local/include"</div><div>ignoring duplicate directory "/usr/local/google/home/jingyue/Work/llvm/install-git/bin/../lib/clang/3.8.0/include"</div><div>ignoring duplicate directory "/usr/include"</div><div>#include "..." search starts here:</div><div>#include <...> search starts here:</div><div> /usr/local/cuda</div><div> /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8</div><div> /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8</div><div> /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/backward</div><div> /usr/local/include</div><div> /usr/local/google/home/jingyue/Work/llvm/install-git/bin/../lib/clang/3.8.0/include</div><div> /usr/include</div><div> /usr/local/cuda/include</div><div>End of search list.</div><div><div class="h5"><div>In file included from <built-in>:614:</div><div>In file included from <command line>:1:</div><div>/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'</div><div>static inline __device__ void __brkpt(int c) { __brkpt(); }</div><div> ^</div><div>/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</div><div>static inline __device__ void __brkpt(int c) { __brkpt(); }</div><div> ^</div><div>In file included from <built-in>:614:</div><div>In file included from <command line>:1:</div><div>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:</div><div>/usr/local/cuda/include/device_functions.hpp:79:38: error: redefinition of 'mulhi'</div><div>__DEVICE_FUNCTIONS_STATIC_DECL__ int mulhi(int a, int b)</div><div> ^</div><div>/usr/local/cuda/include/device_functions.hpp:79:38: note: previous definition is here</div><div>__DEVICE_FUNCTIONS_STATIC_DECL__ int mulhi(int a, int b)</div><div> ^</div><div>In file included from <built-in>:614:</div><div>In file included from <command line>:1:</div><div>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:</div><div>/usr/local/cuda/include/device_functions.hpp:84:47: error: redefinition of 'mulhi'</div><div>__DEVICE_FUNCTIONS_STATIC_DECL__ unsigned int mulhi(unsigned int a, unsigned int b)</div><div> ^</div><div>/usr/local/cuda/include/device_functions.hpp:84:47: note: previous definition is here</div><div>__DEVICE_FUNCTIONS_STATIC_DECL__ unsigned int mulhi(unsigned int a, unsigned int b)</div></div></div></div></div><div class=""><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 11, 2016 at 3:20 PM, Artem Belevich <span dir="ltr"><<a href="mailto:tra@google.com" target="_blank">tra@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Could you add '-v' to command line and send me what it prints on your box?<div><br></div><div><br></div></div><div class="gmail_extra"><div><div><br><div class="gmail_quote">On Mon, Jan 11, 2016 at 3:15 PM, Jingyue Wu <span dir="ltr"><<a href="mailto:jingyue@google.com" target="_blank">jingyue@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Environment:<div>LLVM/Clang version: r257392</div><div>CUDA 7.0</div><div>Ubuntu 14.04</div><div><br></div><div>The axpy code can be found at <a href="http://llvm.org/docs/CompileCudaWithLLVM.html" target="_blank">http://llvm.org/docs/CompileCudaWithLLVM.html</a>. 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? </div><div><br></div><div>Below is the command line I use and the error messages I got:</div><div><br></div><div>jingyue Work% clang++ -I../../common/inc -L/usr/local/cuda/lib64 -I/usr/local/cuda <a href="http://axpy.cu" target="_blank">axpy.cu</a> -lcudart_static -lcuda -ldl -lrt -pthread<br></div><div><br></div><div><div>In file included from <built-in>:614:</div><div>In file included from <command line>:1:</div><div>/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'</div><div>static inline __device__ void __brkpt(int c) { __brkpt(); }</div><div> ^</div><div>/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</div><div>static inline __device__ void __brkpt(int c) { __brkpt(); }</div><div> ^</div><div>In file included from <built-in>:614:</div><div>In file included from <command line>:1:</div><div>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:</div><div>/usr/local/cuda/include/device_functions.hpp:79:38: error: redefinition of 'mulhi'</div><div>__DEVICE_FUNCTIONS_STATIC_DECL__ int mulhi(int a, int b)</div><div> ^</div><div>/usr/local/cuda/include/device_functions.hpp:79:38: note: previous definition is here</div><div>__DEVICE_FUNCTIONS_STATIC_DECL__ int mulhi(int a, int b)</div><div> ^</div><div>In file included from <built-in>:614:</div><div>In file included from <command line>:1:</div><div>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:</div><div>/usr/local/cuda/include/device_functions.hpp:84:47: error: redefinition of 'mulhi'</div><div>__DEVICE_FUNCTIONS_STATIC_DECL__ unsigned int mulhi(unsigned int a, unsigned int b)</div><div> ^</div><div>/usr/local/cuda/include/device_functions.hpp:84:47: note: previous definition is here</div><div>__DEVICE_FUNCTIONS_STATIC_DECL__ unsigned int mulhi(unsigned int a, unsigned int b)</div></div></div>
</blockquote></div><br><br clear="all"><div><br></div></div></div><span><font color="#888888">-- <br><div><div dir="ltr">--Artem Belevich</div></div>
</font></span></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">--Artem Belevich</div></div>
</div></div>