[Openmp-dev] nvlink reported undefined reference

Jon Chesterfield via Openmp-dev openmp-dev at lists.llvm.org
Tue Nov 5 05:05:44 PST 2019


Message: 2
Date: Tue, 5 Nov 2019 02:54:05 +0000
From: "Doerfert, Johannes via Openmp-dev" <openmp-dev at lists.llvm.org>
To: Shilei Tian <tianshilei1992 at gmail.com>
Subject: Re: [Openmp-dev] nvlink reported undefined reference when
        building OpenMP offloading program


I think Jon (CCed) is aware and working on it:

https://reviews.llvm.org/rG764c8420e4b8fc1libomptarget1a9fa94d00f4ee617aa754cb2
<https://reviews.llvm.org/rG764c8420e4b8fc11a9fa94d00f4ee617aa754cb2>

On 11/04, Shilei Tian via Openmp-dev wrote:
> Hi,
>
> I was trying to build an OpenMP offloading program. nvlink always
reported following error:
>
> nvlink error   : Undefined reference to '_Z25GetLogicalThreadIdInBlockb'
in '/tmp/main-02fcf5.cubin'

Hi Shilei,

Thanks for the comprehensive report. I am indeed looking into this.

That you're building for X86 means the problem isn't isolated to POWER8,
which means I can stop looking at cross compilation. I'll update the
discussion. Thanks!

OpenMP still works for me. My nvptx build is a bit precarious though
because trunk conflicts with libstdc++, so the corresponding invocation is:

~/llvm-install/bin/clang --cuda-gpu-arch=sm_50 -fopenmp
-fopenmp-targets=nvptx64 test.cu  -nocudainc -L~/llvm-install/lib
LD_LIBRARY_PATH=~/llvm-build/lib ./a.out

Looking at symbols in the cuda runtime libraries suggests all is well, at
least on my machine.

I believe replacing INLINE with DEVICE in
openmp/libomptarget/deviceRTL/nvptx/src/support.cu will unblock people. I
don't want to propose that as a patch until I can reproduce locally.

Alternatively, using clang instead of nvcc would probably resolve this.
-DCUDA_HOST_COMPILER=`which clang`

Regards,

Jon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20191105/0f0b747d/attachment.html>


More information about the Openmp-dev mailing list