<div dir="ltr">I suspect that the tools are not invoking clang correctly, but I don't know more, there is not enough information given here to say, and I am not familiar with these tools.<div><br></div><div>Since this is not a bug in clang, I would recommend speaking with the tool developers.  If you want to debug yourself I'd try getting a working CUDA compilation with regular clang and running that with -v.  You will see the flags passed to clang -cc1.  Then you can compare those flags to what the tool is doing.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 3, 2019 at 10:34 PM Pradeep Kumar <<a href="mailto:pradeepisro49@gmail.com">pradeepisro49@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Now I get different error for each of the flags<div><b>1. --cuda-host-only</b></div><div><br></div><div>/usr/include/clang/9.0.0/include/__clang_cuda_builtin_vars.h:53:27: error: use of undeclared identifier '__nvvm_read_ptx_sreg_tid_x'<br>  __CUDA_DEVICE_BUILTIN(x,__nvvm_read_ptx_sreg_tid_x());<br>                          ^<br>/usr/include/clang/9.0.0/include/__clang_cuda_builtin_vars.h:54:27: error: use of undeclared identifier '__nvvm_read_ptx_sreg_tid_y'<br>  __CUDA_DEVICE_BUILTIN(y,__nvvm_read_ptx_sreg_tid_y());<br>                          ^<br>/usr/include/clang/9.0.0/include/__clang_cuda_builtin_vars.h:55:27: error: use of undeclared identifier '__nvvm_read_ptx_sreg_tid_z'<br>  __CUDA_DEVICE_BUILTIN(z,__nvvm_read_ptx_sreg_tid_z());<br>                          ^<br>/usr/include/clang/9.0.0/include/__clang_cuda_builtin_vars.h:64:27: error: use of undeclared identifier '__nvvm_read_ptx_sreg_ctaid_x'<br>  __CUDA_DEVICE_BUILTIN(x,__nvvm_read_ptx_sreg_ctaid_x());<br>                          ^<br>/usr/include/clang/9.0.0/include/__clang_cuda_builtin_vars.h:65:27: error: use of undeclared identifier '__nvvm_read_ptx_sreg_ctaid_y'<br>  __CUDA_DEVICE_BUILTIN(y,__nvvm_read_ptx_sreg_ctaid_y());<br>                          ^<br>/usr/include/clang/9.0.0/include/__clang_cuda_builtin_vars.h:66:27: error: use of undeclared identifier '__nvvm_read_ptx_sreg_ctaid_z'<br>  __CUDA_DEVICE_BUILTIN(z,__nvvm_read_ptx_sreg_ctaid_z());<br>                          ^<br>/usr/include/clang/9.0.0/include/__clang_cuda_builtin_vars.h:75:27: error: use of undeclared identifier '__nvvm_read_ptx_sreg_ntid_x'<br>  __CUDA_DEVICE_BUILTIN(x,__nvvm_read_ptx_sreg_ntid_x());<br>                          ^<br>/usr/include/clang/9.0.0/include/__clang_cuda_builtin_vars.h:76:27: error: use of undeclared identifier '__nvvm_read_ptx_sreg_ntid_y'<br>  __CUDA_DEVICE_BUILTIN(y,__nvvm_read_ptx_sreg_ntid_y());<br>                          ^<br>/usr/include/clang/9.0.0/include/__clang_cuda_builtin_vars.h:77:27: error: use of undeclared identifier '__nvvm_read_ptx_sreg_ntid_z'<br>  __CUDA_DEVICE_BUILTIN(z,__nvvm_read_ptx_sreg_ntid_z());<br>                          ^<br>/usr/include/clang/9.0.0/include/__clang_cuda_builtin_vars.h:86:27: error: use of undeclared identifier '__nvvm_read_ptx_sreg_nctaid_x'<br>  __CUDA_DEVICE_BUILTIN(x,__nvvm_read_ptx_sreg_nctaid_x());<br>                          ^<br>/usr/include/clang/9.0.0/include/__clang_cuda_builtin_vars.h:87:27: error: use of undeclared identifier '__nvvm_read_ptx_sreg_nctaid_y'<br>  __CUDA_DEVICE_BUILTIN(y,__nvvm_read_ptx_sreg_nctaid_y());<br>                          ^<br>/usr/include/clang/9.0.0/include/__clang_cuda_builtin_vars.h:88:27: error: use of undeclared identifier '__nvvm_read_ptx_sreg_nctaid_z'<br>  __CUDA_DEVICE_BUILTIN(z,__nvvm_read_ptx_sreg_nctaid_z());<br>                          ^<br>In file included from <built-in>:1:<br>In file included from /usr/include/clang/9.0.0/include/__clang_cuda_runtime_wrapper.h:148:<br>/usr/include/clang/9.0.0/include/__clang_cuda_device_functions.h:49:40: error: use of undeclared identifier '__nvvm_vote_all'<br>__DEVICE__ int __all(int __a) { return __nvvm_vote_all(__a); }<br>                                       ^<br>/usr/include/clang/9.0.0/include/__clang_cuda_device_functions.h:50:40: error: use of undeclared identifier '__nvvm_vote_any'<br>__DEVICE__ int __any(int __a) { return __nvvm_vote_any(__a); }<br>                                       ^<br>/usr/include/clang/9.0.0/include/__clang_cuda_device_functions.h:51:52: error: use of undeclared identifier '__nvvm_vote_ballot'<br>__DEVICE__ unsigned int __ballot(int __a) { return __nvvm_vote_ballot(__a); }<br>                                                   ^<br>/usr/include/clang/9.0.0/include/__clang_cuda_device_functions.h:71:10: error: use of undeclared identifier '__nvvm_atom_add_gen_d'<br>  return __nvvm_atom_add_gen_d(__p, __v);<br>         ^<br>/usr/include/clang/9.0.0/include/__clang_cuda_device_functions.h:74:10: error: use of undeclared identifier '__nvvm_atom_cta_add_gen_d'<br>  return __nvvm_atom_cta_add_gen_d(__p, __v);<br>         ^<br>/usr/include/clang/9.0.0/include/__clang_cuda_device_functions.h:77:10: error: use of undeclared identifier '__nvvm_atom_sys_add_gen_d'<br>  return __nvvm_atom_sys_add_gen_d(__p, __v);<br>         ^<br>/usr/include/clang/9.0.0/include/__clang_cuda_device_functions.h:195:10: error: use of undeclared identifier '__nvvm_atom_add_gen_f'<br>  return __nvvm_atom_add_gen_f(__p, __v);<br></div><div><br></div><div><b>2. --cuda-device-only</b></div><div><br></div><div>/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cmath:845:35: error: use of undeclared identifier 'FP_NAN'<br>      return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,<br>                                  ^<br>/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cmath:845:43: error: use of undeclared identifier 'FP_INFINITE'<br>      return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,<br>                                          ^<br>/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cmath:845:56: error: use of undeclared identifier 'FP_NORMAL'<br>      return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,<br>                                                       ^<br>/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cmath:846:7: error: use of undeclared identifier 'FP_SUBNORMAL'<br>                                  FP_SUBNORMAL, FP_ZERO, __type(__f));<br>                                  ^<br>/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cmath:846:21: error: use of undeclared identifier 'FP_ZERO'<br>                                  FP_SUBNORMAL, FP_ZERO, __type(__f));<br>                                                ^<br>In file included from <built-in>:1:<br>In file included from /usr/include/clang/9.0.0/include/__clang_cuda_runtime_wrapper.h:37:<br>/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cstdlib:200:11: error: no member named 'lldiv_t' in the global namespace; did you mean 'ldiv_t'?<br>  using ::lldiv_t;<br>        ~~^<br>/usr/include/stdlib.h:109:5: note: 'ldiv_t' declared here<br>  } ldiv_t;<br>    ^<br>In file included from <built-in>:1:<br>In file included from /usr/include/clang/9.0.0/include/__clang_cuda_runtime_wrapper.h:37:<br>/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cstdlib:206:11: error: no member named '_Exit' in the global namespace<br>  using ::_Exit;<br>        ~~^<br>/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cstdlib:212:10: error: unknown type name 'lldiv_t'; did you mean 'ldiv_t'?<br>  inline lldiv_t<br>         ^<br>/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cstdlib:200:11: note: 'ldiv_t' declared here<br>  using ::lldiv_t;<br>          ^<br>/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cstdlib:214:5: error: unknown type name 'lldiv_t'; did you mean 'ldiv_t'?<br>  { lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }<br>    ^<br>/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cstdlib:200:11: note: 'ldiv_t' declared here<br>  using ::lldiv_t;<br>          ^<br>/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cstdlib:216:11: error: no member named 'lldiv' in the global namespace; did you mean 'ldiv'?<br>  using ::lldiv;<br>        ~~^<br>/usr/include/stdlib.h:790:15: note: 'ldiv' declared here<br>extern ldiv_t ldiv (long int __numer, long int __denom)<br>              ^<br>In file included from <built-in>:1:<br>In file included from /usr/include/clang/9.0.0/include/__clang_cuda_runtime_wrapper.h:37:<br>/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cstdlib:227:11: error: no member named 'atoll' in the global namespace; did you mean 'atol'?<br>  using ::atoll;<br>        ~~^<br>/usr/include/stdlib.h:150:17: note: 'atol' declared here<br>extern long int atol (const char *__nptr)<br>                ^<br>In file included from <built-in>:1:<br>In file included from /usr/include/clang/9.0.0/include/__clang_cuda_runtime_wrapper.h:37:<br>/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cstdlib:228:11: error: no member named 'strtoll' in the global namespace<br>  using ::strtoll;<br>        ~~^<br>/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cstdlib:229:11: error: no member named 'strtoull' in the global namespace; did you mean 'strtoul'?<br>  using ::strtoull;<br></div><div><br></div><div><br></div><div>can you please let me know why it is happening.</div><div><br></div><div>Regards,</div><div>Pradeep</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 4, 2019 at 10:52 AM Justin Lebar <<a href="mailto:jlebar@google.com" target="_blank">jlebar@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">> But the unable to handle compilation, expected exactly one compiler job still exists.<div><br></div><div>This is a new error that I don't see in the original email.  Luckily I know the error you're referring to.  You will need --cuda-device-only or --cuda-host-only.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 3, 2019 at 10:04 PM Pradeep Kumar <<a href="mailto:pradeepisro49@gmail.com" target="_blank">pradeepisro49@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Dear Justin,<div>    clang-query also results in the same error. I removed the one with no sm_20 by passing cuda-gpu-arch=sm_50 flag. But the unable to handle compilation, expected exactly one compiler job still exists. I think it is because of the dual mode compilation in clang. There are more than two commands in the error string.</div><div><br></div><div>Regards,</div><div>Pradeep</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 3, 2019 at 9:22 PM Justin Lebar <<a href="mailto:jlebar@google.com" target="_blank">jlebar@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">> GPU arch sm_20 is supported by CUDA versions between 7.0 and 8.0 (inclusive), but installation at /usr/local/cuda is 9.0.  Use --cuda-path to specify a different CUDA install, pass a different GPU arch with --cuda-gpu-arch, or pass --no-cuda-version-check.<br><div><br></div><div>The error seems pretty clear to me?</div><div><br></div><div>You will need to figure out how to get the tool to pass these flags to clang.  That's a question for the tool's author, not for this mailing list.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 3, 2019 at 1:22 AM Pradeep Kumar via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Dear clang-developer-community,<div>   I get the following error while running libtooling based tool on CUDA code but I didn't get the message when running libclang based tool. Please refer the following link for the error.</div><div><br></div><div><a href="https://gist.github.com/pradeepisro/57e3ff3dab609a8bcc4f66d029e15a8f" target="_blank">https://gist.github.com/pradeepisro/57e3ff3dab609a8bcc4f66d029e15a8f</a><br></div><div><br></div><div>I used the following repo to test</div><div><a href="https://github.com/peter-can-talk/cppnow-2017" target="_blank">https://github.com/peter-can-talk/cppnow-2017</a><br></div><div><br></div><div>the example code is </div><div>1. cppgrep - libclang tool</div><div>2. virtual-destructor - libtooling tool</div><div><br></div><div>With Regards,</div><div>Pradeep Kumar S.</div></div>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>