<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">It's hard to tell what exactly is going on. I have neither CUDA 8 for ARM, nor, apparently, any ARM-specific headers -- clang complains that it can't find <cmath>.</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">Complaints about calling __device__ function from __host__ function usually indicate that we're missing a __host__ version of the callee, in this case '__isinf(double)'. I'd start with checking whether it's available for c++ compilation. If it is, then you'll need to figure out why it's not included in time for cuda's pre-included headers to work. If the function is not available in principle, then you may need to provide a stub. Or figure out why cuda headers define __host__ functions. It's possible that the preprocessor magic clang currently uses to make CUDA headers work on x86 may need to be adjusted for ARM.</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">--Artem</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_quote"><div dir="ltr">On Fri, Mar 23, 2018 at 12:57 PM Justin Lebar <<a href="mailto:jlebar@google.com" target="_blank">jlebar@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><a class="m_2307016550770402105m_4198338068115570067GWVZpf m_2307016550770402105m_4198338068115570067gW" id="m_2307016550770402105m_4198338068115570067IloFPc-11" href="mailto:tra@google.com" target="_blank">+Artem Belevich</a> <br></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Mar 23, 2018 at 7:53 PM Bharath Bhoopalam via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I was wondering if anyone has encountered this issue when cross compiling cuda on Nvidia TX2 running android. <div><br></div><div>The error is </div><div><div>In file included from <built-in>:1:</div><div>In file included from prebuilts/clang/host/linux-x86/clang-4667116/lib64/clang/7.0.1/include/__clang_cuda_runtime_wrapper.h:219:</div><div>../cuda/targets/aarch64-linux-androideabi/include/<div class="gmail_default" style="font-family:verdana,sans-serif;display:inline">​​</div>math_functions.hpp:3477:19: error: no matching function for call to '__isinf'</div><div>  if (a == 0.0 || __isinf(a)) {</div><div>                  ^~~~~~~</div><div>../cuda/targets/aarch64-linux-androideabi/include/math_functions_dbl_ptx3.hpp:165:38: note: candidate function not viable: call to __device__ function</div><div>      from __host__ function</div><div>__MATH_FUNCTIONS_DBL_PTX3_DECL__ int __isinf(double a) __THROW</div><div>                                     ^</div><div>In file included from <built-in>:1:</div><div>In file included from ../prebuilts/clang/host/linux-x86/clang-4667116/lib64/clang/7.0.1/include/__clang_cuda_runtime_wrapper.h:219:</div><div>../cuda/targets/aarch64-linux-androideabi/include/math_functions.hpp:3501:19: error: no matching function for call to '__isinf'</div><div>  if (a == 0.0 || __isinf(a)) {</div><div>                  ^~~~~~~</div><div>../cuda/targets/aarch64-linux-androideabi/include/math_functions_dbl_ptx3.hpp:165:38: note: candidate function not viable: call to __device__ function</div><div>      from __host__ function</div><div>__MATH_FUNCTIONS_DBL_PTX3_DECL__ int __isinf(double a) __THROW</div><div>                                     ^</div><div>In file included from <built-in>:1:</div><div>In file included from ../prebuilts/clang/host/linux-x86/clang-4667116/lib64/clang/7.0.1/include/__clang_cuda_runtime_wrapper.h:219:</div><div>../cuda/targets/aarch64-linux-androideabi/include/math_functions.hpp:3527:7: error: no matching function for call to '__isinf'</div><div>  if (__isinf(a)) {</div><div>      ^~~~~~~</div><div>../aarch64-linux-androideabi/include/math_functions_dbl_ptx3.hpp:165:38: note: candidate function not viable: call to __device__ function</div><div>      from __host__ function</div><div>__MATH_FUNCTIONS_DBL_PTX3_DECL__ int __isinf(double a) __THROW</div><div>                                     ^</div><div>3 errors generated when compiling for sm_20.</div></div><div><br></div><div><br></div><div>The command I used  is following</div><div><br></div><div><div>prebuilts/clang/host/linux-x86/clang-4667116/bin/clang++ \</div><div>-v \</div><div><div class="gmail_default" style="font-family:verdana,sans-serif;display:inline">​​</div><div class="gmail_default" style="font-family:verdana,sans-serif;display:inline">​​</div>-target aarch64-linux-androideabi  \</div><div>--cuda-path=/cuda/targets/aarch64-linux-androideabi \</div><div>-I ./cuda/targets/aarch64-linux-androideabi/ \</div><div>-I ../platforms/android-24/arch-arm64/usr/include \</div><div>-I .<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">prebuilts/ndk/current/sources</span>/sources/cxx-stl/gnu-libstdc++/4.9/include \</div><div>-I prebuilts/ndk/current/sources/cxx-stl/gnu-libstdc++/4.9/libs/arm64-v8a/include \</div><div>-I ndk/sources/cxx-stl/system/include \</div><div>-L <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">./cuda/targets/aarch64-linux-androideabi/lib \</span> </div><div>-lcudart -lcudart_static -ldl -lrt -pthread \<br></div><div>-o axpy <a href="http://axpy.cu" target="_blank">axpy.cu</a><br></div></div><div><br></div><div>clang version I am using is </div><div><div>Android (4667116 based on r326829) clang version 7.0.1 (<a href="https://android.googlesource.com/toolchain/clang" target="_blank">https://android.googlesource.com/toolchain/clang</a> 76e4d638afc560ad21845fad570888bef8c18045) (<a href="https://android.googlesource.com/toolchain/llvm" target="_blank">https://android.googlesource.com/toolchain/llvm</a> 67f3e6a51d93777841e0fb6d07f71fdf343df239) (based on LLVM 7.0.1svn)</div><div>Target: aarch64--linux-android</div><div>Thread model: posix</div></div><div><br></div><div><br></div><div>I dont have any issues build this file for native platform (ubuntu14.04)</div><div>clang++ </div><div><div>--cuda-path=/usr/local/cuda-8.0 \</div><div>-I /usr/local/cuda-8.0/include \</div><div>-L/usr/local/cuda-8.0/lib64  \</div><div>-lcudart -lcudart_static -ldl -lrt -pthread \</div><div>-o axpy <a href="http://axpy.cu" target="_blank">axpy.cu</a></div></div><div><br></div><div>any guidance is appreciated.</div><div><br></div><div><br></div></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="m_2307016550770402105gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">--Artem Belevich</div></div></div>