[Openmp-dev] nvlink reported undefined reference when building OpenMP offloading program

Itaru Kitayama via Openmp-dev openmp-dev at lists.llvm.org
Mon Nov 4 18:52:31 PST 2019


You can set like “clang;openmp” to build them at once.

On Tue, Nov 5, 2019 at 11:31 Shilei Tian via Openmp-dev <
openmp-dev at lists.llvm.org> 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'
> nvlink error   : Undefined reference to '_Z13checkSPMDModeP5ident' in
> '/tmp/main-02fcf5.cubin'
> nvlink error   : Undefined reference to '_Z14GetOmpThreadIdib' in
> '/tmp/main-02fcf5.cubin'
> nvlink error   : Undefined reference to
> '_Z22setExecutionParameters13ExecutionMode11RuntimeMode' in
> '/tmp/main-02fcf5.cubin'
> nvlink error   : Undefined reference to '_Z18GetThreadIdInBlockv' in
> '/tmp/main-02fcf5.cubin'
> nvlink error   : Undefined reference to '_Z24GetNumberOfWorkersInTeamv' in
> '/tmp/main-02fcf5.cubin'
> nvlink error   : Undefined reference to '_Z16IncParallelLevelbj' in
> '/tmp/main-02fcf5.cubin'
> nvlink error   : Undefined reference to '_Z16DecParallelLevelbj' in
> '/tmp/main-02fcf5.cubin’
>
> I was using clang which was built with trunk via following CMake command:
>
> cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86;NVPTX"
> -DLLVM_ENABLE_PROJECTS="clang;openmp"
> -DCLANG_OPENMP_NVPTX_DEFAULT_ARCH=sm_75
> -DLIBOMPTARGET_NVPTX_COMPUTE_CAPABILITIES=75
> -DCMAKE_INSTALL_PREFIX=$HOME/.local ../llvm
> make -j $(nproc)
>
> OpenMP library was built via following CMake command:
>
> cmake -DCMAKE_C_COMPILER=$HOME/.local/bin/clang
> -DCMAKE_CXX_COMPILER=$HOME/.local/bin/clang++ -DCMAKE_BUILD_TYPE=Release
> -DCMAKE_INSTALL_PREFIX=$HOME/.local
> -DLIBOMPTARGET_NVPTX_COMPUTE_CAPABILITIES=75 ..
> make -j $(nproc)
>
> And finally the compilation command is:
>
> clang -fopenmp -fopenmp-targets=nvptx64 main.c
>
> Did I miss something? The program is very simple:
>
>  int main() {
>    int i = 0;
>
>  #pragma omp target nowait
>    {
>      i++;
>      int k = 0;
>      ++k;
>    }
>
>    int j = 0;
>  #pragma omp target nowait
>    {
>      ++j;
>    }
>
>    return 0;
>  }
>
> I have CUDA 10.1 on the system.
>
> Regards,
> Shilei
>
> _______________________________________________
> Openmp-dev mailing list
> Openmp-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20191105/cf91b7a6/attachment.html>


More information about the Openmp-dev mailing list