<span style=" font-size:10pt;font-family:sans-serif">Hi Talita,</span><br><br><span style=" font-size:10pt;font-family:sans-serif">You may be linking
against the wrong OpenMP library.</span><br><br><span style=" font-size:10pt;font-family:sans-serif">Have you built
the OpenMP runtime library? If you have you then also need to set up your
environment to pick it up instead of some other default option. To be sure
you use the library you intend you can use the -I and -L compiler flags
to pass the location of the omp.h header file and the libomp.so runtime
library you intend to use.</span><br><br><span style=" font-size:10pt;font-family:sans-serif">Thanks,</span><br><br><span style=" font-size:10pt;font-family:sans-serif">--Doru</span><br><span style=" font-size:9pt;font-family:Arial"><br></span><br><br><br><br><span style=" font-size:9pt;color:#5f5f5f;font-family:sans-serif">From:
       </span><span style=" font-size:9pt;font-family:sans-serif">Talita
Perciano via Openmp-dev <openmp-dev@lists.llvm.org></span><br><span style=" font-size:9pt;color:#5f5f5f;font-family:sans-serif">To:
       </span><span style=" font-size:9pt;font-family:sans-serif">openmp-dev@lists.llvm.org</span><br><span style=" font-size:9pt;color:#5f5f5f;font-family:sans-serif">Date:
       </span><span style=" font-size:9pt;font-family:sans-serif">07/02/2019
02:25 PM</span><br><span style=" font-size:9pt;color:#5f5f5f;font-family:sans-serif">Subject:
       </span><span style=" font-size:9pt;font-family:sans-serif">[EXTERNAL]
[Openmp-dev] GPU offloading with clang</span><br><span style=" font-size:9pt;color:#5f5f5f;font-family:sans-serif">Sent
by:        </span><span style=" font-size:9pt;font-family:sans-serif">"Openmp-dev"
<openmp-dev-bounces@lists.llvm.org></span><br><hr noshade><br><br><br><span style=" font-size:12pt">Hi,</span><br><br><span style=" font-size:12pt">I'm trying to use openmp offloading to
gpu, and I'm getting linking errors during compilation:</span><br><br><span style=" font-size:12pt">[  7%] Linking CXX executable MPI_PMRF<br>/usr/bin/ld: CMakeFiles/MPI_PMRF.dir-------/cfuncs-pmrf.c.o:(.rodata..omp_offloading.device_images[.omp_offloading.descriptor_reg.nvptx64-nvidia-cuda]+0x10):
undefined reference to `.omp_offloading.entries_begin'<br>/usr/bin/ld: CMakeFiles/MPI_PMRF.dir-------/cfuncs-pmrf.c.o:(.rodata..omp_offloading.device_images[.omp_offloading.descriptor_reg.nvptx64-nvidia-cuda]+0x18):
undefined reference to `.omp_offloading.entries_end'<br>/usr/bin/ld: CMakeFiles/MPI_PMRF.dir/-------/cfuncs-pmrf.c.o:(.rodata..omp_offloading.descriptor[.omp_offloading.descriptor_reg.nvptx64-nvidia-cuda]+0x10):
undefined reference to `.omp_offloading.entries_begin'<br>/usr/bin/ld: CMakeFiles/MPI_PMRF.dir/-------/cfuncs-pmrf.c.o:(.rodata..omp_offloading.descriptor[.omp_offloading.descriptor_reg.nvptx64-nvidia-cuda]+0x18):
undefined reference to `.omp_offloading.entries_end'<br>/usr/bin/ld: link errors found, deleting executable `MPI_PMRF'<br>clang-9: error: linker command failed with exit code 1 (use -v to see invocation)<br>CMakeFiles/MPI_PMRF.dir/build.make:265: recipe for target 'MPI_PMRF' failed<br>make[2]: *** [MPI_PMRF] Error 1<br>CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/MPI_PMRF.dir/all'
failed<br>make[1]: *** [CMakeFiles/MPI_PMRF.dir/all] Error 2<br>Make</span><a href="file://83:"><span style=" font-size:12pt">file:83:</span></a><span style=" font-size:12pt">recipe for target 'all' failed<br>make: *** [all] Error 2</span><br><br><span style=" font-size:12pt">I actually can compile the code just
fine without the #pragma omp target.</span><br><br><span style=" font-size:12pt">Some additional info:</span><br><br><span style=" font-size:12pt">- I'm compiling the code with <b>-fopenmp
-fopenmp-targets=nvptx64-nvidia-cuda</b></span><br><br><span style=" font-size:12pt">- <b>clang version 9.0.0</b> (</span><a href="https://github.com/clang-ykt/clang"><span style=" font-size:12pt;color:blue"><u>https://github.com/clang-ykt/clang</u></span></a><span style=" font-size:12pt">e50a43ae7e2fe6e6ff515cedb2a8ae658120e32f) (</span><a href="https://github.com/clang-ykt/llvm"><span style=" font-size:12pt;color:blue"><u>https://github.com/clang-ykt/llvm</u></span></a><span style=" font-size:12pt">3cd66813b063ab08a389470f1bc53e18fbe595b2)</span><br><br><span style=" font-size:12pt">- <b>cuda info:</b></span><br><br><span style=" font-size:12pt">+-----------------------------------------------------------------------------+<br>| NVIDIA-SMI 418.67       Driver Version: 418.67  
    CUDA Version: 10.1     |<br>|-------------------------------+----------------------+----------------------+<br>| GPU  Name        Persistence-M| Bus-Id  
     Disp.A | Volatile Uncorr. ECC |<br>| Fan  Temp  Perf  Pwr:Usage/Cap|        
Memory-Usage | GPU-Util  Compute M. |<br>|===============================+======================+======================|<br>|   0  Tesla V100-SXM2...  On   | 00000000:3E:00.0
Off |                    0
|<br>| N/A   30C    P0    38W / 300W |    
 0MiB / 16130MiB |      0%      Default
|<br>+-------------------------------+----------------------+----------------------+</span><br><br><span style=" font-size:12pt">- Linux kernel: <b>4.4.176-96-default</b></span><br><br><span style=" font-size:12pt">Any thoughts?</span><br><br><span style=" font-size:12pt">Thanks!</span><br><span style=" font-size:12pt">Talita</span><br><tt><span style=" font-size:10pt">_______________________________________________<br>Openmp-dev mailing list<br>Openmp-dev@lists.llvm.org<br></span></tt><a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev"><tt><span style=" font-size:10pt">https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev</span></tt></a><tt><span style=" font-size:10pt"><br></span></tt><br><br><BR>