[Openmp-dev] Compiling OpenMP code with CUDA support using libc++
G Zhao via Openmp-dev
openmp-dev at lists.llvm.org
Wed Mar 4 21:25:17 PST 2020
Hi,
I just compiled LLVM and enable NVPTX by
-DLLVM_TARGETS_TO_BUILD="X86;NVPTX". But when I compiled my code using the
below command:
clang++ main.cpp -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda -o a_gpu.exe
I got the below error:
/usr/lib64/gcc/x86_64-pc-linux-gnu/9.2.1/../../../../include/c++/9.2.1/bits/std_abs.h:75:3:
error: declaration conflicts with target of using declaration already in
scope
abs(float __x)
I think the reason is I am using GCC-9. I did a bit search and someone said
using libc++ can address this. So I compiled libcxx and libcxxabi, and used
the below command to compile my code again:
clang++ stdlib=libc++ main.cpp -fopenmp
-fopenmp-targets=nvptx64-nvidia-cuda -o a_gpu.exe
I got different errors:
nvlink error : Undefined reference to
'_ZNKSt3__120__vector_base_commonILb1EE20__throw_length_errorEv' in
'/tmp/main-42e0a6.cubin'
nvlink error : Undefined reference to 'abort' in '/tmp/main-42e0a6.cubin'
I think the reason here is nvlink don't know we should link libc++ with
those cubin files together. But I don't know how to solve this.
Any one know a workaround to this?
Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20200304/46f615e1/attachment.html>
More information about the Openmp-dev
mailing list