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

Doerfert, Johannes via Openmp-dev openmp-dev at lists.llvm.org
Mon Nov 4 18:54:05 PST 2019


I think Jon (CCed) is aware and working on it:
  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'
> 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


-- 

Johannes Doerfert
Researcher

Argonne National Laboratory
Lemont, IL 60439, USA

jdoerfert at anl.gov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20191105/99965ed9/attachment.sig>


More information about the Openmp-dev mailing list