[llvm-dev] cuda cross compiling issue for target aarch64-linux-androideabi

Artem Belevich via llvm-dev llvm-dev at lists.llvm.org
Wed Mar 28 13:39:34 PDT 2018


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>.

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.

--Artem

On Fri, Mar 23, 2018 at 12:57 PM Justin Lebar <jlebar at google.com> wrote:

> +Artem Belevich <tra at google.com>
>
> On Fri, Mar 23, 2018 at 7:53 PM Bharath Bhoopalam via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>> I was wondering if anyone has encountered this issue when cross compiling
>> cuda on Nvidia TX2 running android.
>>
>> The error is
>> In file included from <built-in>:1:
>> In file included from
>> prebuilts/clang/host/linux-x86/clang-4667116/lib64/clang/7.0.1/include/__clang_cuda_runtime_wrapper.h:219:
>> ../cuda/targets/aarch64-linux-androideabi/include/
>> ​​
>> math_functions.hpp:3477:19: error: no matching function for call to
>> '__isinf'
>>   if (a == 0.0 || __isinf(a)) {
>>                   ^~~~~~~
>> ../cuda/targets/aarch64-linux-androideabi/include/math_functions_dbl_ptx3.hpp:165:38:
>> note: candidate function not viable: call to __device__ function
>>       from __host__ function
>> __MATH_FUNCTIONS_DBL_PTX3_DECL__ int __isinf(double a) __THROW
>>                                      ^
>> In file included from <built-in>:1:
>> In file included from
>> ../prebuilts/clang/host/linux-x86/clang-4667116/lib64/clang/7.0.1/include/__clang_cuda_runtime_wrapper.h:219:
>> ../cuda/targets/aarch64-linux-androideabi/include/math_functions.hpp:3501:19:
>> error: no matching function for call to '__isinf'
>>   if (a == 0.0 || __isinf(a)) {
>>                   ^~~~~~~
>> ../cuda/targets/aarch64-linux-androideabi/include/math_functions_dbl_ptx3.hpp:165:38:
>> note: candidate function not viable: call to __device__ function
>>       from __host__ function
>> __MATH_FUNCTIONS_DBL_PTX3_DECL__ int __isinf(double a) __THROW
>>                                      ^
>> In file included from <built-in>:1:
>> In file included from
>> ../prebuilts/clang/host/linux-x86/clang-4667116/lib64/clang/7.0.1/include/__clang_cuda_runtime_wrapper.h:219:
>> ../cuda/targets/aarch64-linux-androideabi/include/math_functions.hpp:3527:7:
>> error: no matching function for call to '__isinf'
>>   if (__isinf(a)) {
>>       ^~~~~~~
>> ../aarch64-linux-androideabi/include/math_functions_dbl_ptx3.hpp:165:38:
>> note: candidate function not viable: call to __device__ function
>>       from __host__ function
>> __MATH_FUNCTIONS_DBL_PTX3_DECL__ int __isinf(double a) __THROW
>>                                      ^
>> 3 errors generated when compiling for sm_20.
>>
>>
>> The command I used  is following
>>
>> prebuilts/clang/host/linux-x86/clang-4667116/bin/clang++ \
>> -v \
>> ​​
>> ​​
>> -target aarch64-linux-androideabi  \
>> --cuda-path=/cuda/targets/aarch64-linux-androideabi \
>> -I ./cuda/targets/aarch64-linux-androideabi/ \
>> -I ../platforms/android-24/arch-arm64/usr/include \
>> -I .prebuilts/ndk/current/sources/sources/cxx-stl/gnu-libstdc++/4.9/include
>> \
>> -I
>> prebuilts/ndk/current/sources/cxx-stl/gnu-libstdc++/4.9/libs/arm64-v8a/include
>> \
>> -I ndk/sources/cxx-stl/system/include \
>> -L ./cuda/targets/aarch64-linux-androideabi/lib \
>> -lcudart -lcudart_static -ldl -lrt -pthread \
>> -o axpy axpy.cu
>>
>> clang version I am using is
>> Android (4667116 based on r326829) clang version 7.0.1 (
>> https://android.googlesource.com/toolchain/clang
>> 76e4d638afc560ad21845fad570888bef8c18045) (
>> https://android.googlesource.com/toolchain/llvm
>> 67f3e6a51d93777841e0fb6d07f71fdf343df239) (based on LLVM 7.0.1svn)
>> Target: aarch64--linux-android
>> Thread model: posix
>>
>>
>> I dont have any issues build this file for native platform (ubuntu14.04)
>> clang++
>> --cuda-path=/usr/local/cuda-8.0 \
>> -I /usr/local/cuda-8.0/include \
>> -L/usr/local/cuda-8.0/lib64  \
>> -lcudart -lcudart_static -ldl -lrt -pthread \
>> -o axpy axpy.cu
>>
>> any guidance is appreciated.
>>
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>
>

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


More information about the llvm-dev mailing list