Jost, Gabriele (ARC-TNC)[Supersmith] via llvm-dev
2021-Oct-22 23:15 UTC
[llvm-dev] Trying to build clang-13 for openmp target offload
Hello, I am trying to build clang-13 with support for OpenMP target offload to Nvidia GPUS. I can build clang, but it stubbornly refuses to build the openmpRTL, I get this in the cmake output: - Could NOT find LIBOMPTARGET_DEP_VEO (missing: LIBOMPTARGET_DEP_VEO_LIBRARIES LIBOMPTARGET_DEP_VEOSINFO_LIBRARIES LIBOMPTARGET_DEP_V EO_INCLUDE_DIRS) -- LIBOMPTARGET: Building offloading runtime library libomptarget. -- LIBOMPTARGET: Not building aarch64 offloading plugin: machine not found in the system. -- LIBOMPTARGET: Building AMDGPU plugin for dlopened libhsa -- LIBOMPTARGET: Not generating amdgcn test targets as amdgpu-arch is not found -- LIBOMPTARGET: Building CUDA offloading plugin. -- LIBOMPTARGET: Building CUDA plugin linked against libcuda -- LIBOMPTARGET: Enable tests using CUDA plugin -- LIBOMPTARGET: Not building PPC64 offloading plugin: machine not found in the system. -- LIBOMPTARGET: Not building PPC64le offloading plugin: machine not found in the system. -- LIBOMPTARGET: Not building nec-aurora plugin: libveo or libveosinfo not found. -- LIBOMPTARGET: Not building x86_64 offloading plugin: libffi dependency not found. -- LIBOMPTARGET: Building AMDGCN device RTL. Using clang from in-tree build -- LIBOMPTARGET: Not building NVPTX deviceRTL: clang not found -- LIBOMPTARGET: Not building NVPTX deviceRTL: clang not found -- LIBOMPTARGET: Building the llvm-omp-device-info tool So, it wants an existig clang. I already have a clang built, I tried to use the old clang rather than gcc, but that lead to other errors. The AMDGCM RTL is built using the in-tree clang. Is there a way to do the same for nvptx? I has also tried a 2-step approach, building the deviceRTL seperately, but then it complaints about some previously built tools. Have you encountered such a situation before and can maybe provide some guidance? Here is the cmake I am using: CMAKE_OPTIONS="\ -DLLVM_ENABLE_PROJECTS=clang \ -DLLVM_ENABLE_RUNTIMES=openmp;compiler-rt \ -DLLVM_TARGETS_TO_BUILD=X86;NVPTX \ -DCMAKE_LIBRARY_PATH='${LD_LIBRARY_PATH};/lib64;${CUDA_PATH}/lib64/stubs' \ -DLIBOMPTARGET_DEP_LIBELF_LIBRARIES:FILEPATH=/usr/lib64/libelf.so.1 \ -DLIBOMPTARGET_DEP_LIBELF_INCLUDE_DIR=/usr/include \ -DLIBOMPTARGET_DEP_LIBFFI_INCLUDE_DIR=/usr/include:${CLANG}/extra-includes \ -DFFI_INCLUDE_DIR:PATH=/usr/include \ -DLIBOMPTARGET_DEP_LIBFFI_LIBRARIES=${CLANG}/extra-libs/libffi.so \ -DCMAKE_C_COMPILER=gcc\ -DCMAKE_CXX_COMPILER=g++ \ -DLLVM_ENABLE_BACKTRACES=ON \ -DLLVM_ENABLE_WERROR=OFF \ -DLLVM_ENABLE_RTTI=ON \ -DLIBOMP_FORTRAN_MODULES=ON \ -DOPENMP_ENABLE_LIBOMPTARGET=ON \ -DLIBOMPTARGET_NVPTX_COMPUTE_CAPABILITIES=35,60,70 \ -DCLANG_OPENMP_NVPTX_DEFAULT_ARCH=sm_${COMPUTE_CAPABILITY}" Gabriele Jost ************************************************************************ Gabriele Jost NASA Ames Research Center Email: Gabriele.Jost at nasa.gov Mail Stop 258-6 Work Phone: (650) 604-0468 Bldg. 258, Rm. 232-4 Scientific & HPC Application P.O. Box 1 Development/Optimization Moffett Field, CA 94035-0001 ************************************************************************ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20211022/91793694/attachment.html>
Michael Kruse via llvm-dev
2021-Oct-24 01:47 UTC
[llvm-dev] Trying to build clang-13 for openmp target offload
Hi, If using LLVM_ENABLE_PROJECTS=clang;openmp (or LLVM_ENABLE_PROJECTS=clang and LLVM_ENABLE_RUNTIMES=openmp), libomptarget should pick-up in-tree clang itself. The relevant change (ofr LLVM_ENABLE_PROJECTS=clang;openmp) is https://reviews.llvm.org/D101265, which I just checked landed in the release of clang 13. Are you maybe using a pre-release version of clang 13? In any case, you should be able to explicitly set the clang for the device RTL using -DLIBOMPTARGET_NVPTX_CUDA_COMPILER=... Just compile clang first, then re-configure using the DLIBOMPTARGET_NVPTX_CUDA_COMPILER set to the clang executable you just build. Note that this just changed for clang-14 which uses the clang found in LLVM_TOOLS_BINARY_DIR. Michael Am Fr., 22. Okt. 2021 um 18:16 Uhr schrieb Jost, Gabriele (ARC-TNC)[Supersmith] via llvm-dev <llvm-dev at lists.llvm.org>:> > Hello, > > I am trying to build clang-13 with support for OpenMP target offload to Nvidia GPUS. > > I can build clang, but it stubbornly refuses to build the openmpRTL, I get this in the cmake output: > > > > - Could NOT find LIBOMPTARGET_DEP_VEO (missing: LIBOMPTARGET_DEP_VEO_LIBRARIES LIBOMPTARGET_DEP_VEOSINFO_LIBRARIES LIBOMPTARGET_DEP_V > > EO_INCLUDE_DIRS) > > -- LIBOMPTARGET: Building offloading runtime library libomptarget. > > -- LIBOMPTARGET: Not building aarch64 offloading plugin: machine not found in the system. > > -- LIBOMPTARGET: Building AMDGPU plugin for dlopened libhsa > > -- LIBOMPTARGET: Not generating amdgcn test targets as amdgpu-arch is not found > > -- LIBOMPTARGET: Building CUDA offloading plugin. > > -- LIBOMPTARGET: Building CUDA plugin linked against libcuda > > -- LIBOMPTARGET: Enable tests using CUDA plugin > > -- LIBOMPTARGET: Not building PPC64 offloading plugin: machine not found in the system. > > -- LIBOMPTARGET: Not building PPC64le offloading plugin: machine not found in the system. > > -- LIBOMPTARGET: Not building nec-aurora plugin: libveo or libveosinfo not found. > > -- LIBOMPTARGET: Not building x86_64 offloading plugin: libffi dependency not found. > > -- LIBOMPTARGET: Building AMDGCN device RTL. Using clang from in-tree build > > -- LIBOMPTARGET: Not building NVPTX deviceRTL: clang not found > > -- LIBOMPTARGET: Not building NVPTX deviceRTL: clang not found > > -- LIBOMPTARGET: Building the llvm-omp-device-info tool > > > > So, it wants an existig clang. I already have a clang built, I tried to use the old clang rather than gcc, but that lead to other errors. > > The AMDGCM RTL is built using the in-tree clang. Is there a way to do the same for nvptx? > > > > I has also tried a 2-step approach, building the deviceRTL seperately, but then it complaints about some previously built tools. > > > > Have you encountered such a situation before and can maybe provide some guidance? > > > > Here is the cmake I am using: > > CMAKE_OPTIONS="\ > > -DLLVM_ENABLE_PROJECTS=clang \ > > -DLLVM_ENABLE_RUNTIMES=openmp;compiler-rt \ > > -DLLVM_TARGETS_TO_BUILD=X86;NVPTX \ > > -DCMAKE_LIBRARY_PATH='${LD_LIBRARY_PATH};/lib64;${CUDA_PATH}/lib64/stubs' \ > > -DLIBOMPTARGET_DEP_LIBELF_LIBRARIES:FILEPATH=/usr/lib64/libelf.so.1 \ > > -DLIBOMPTARGET_DEP_LIBELF_INCLUDE_DIR=/usr/include \ > > -DLIBOMPTARGET_DEP_LIBFFI_INCLUDE_DIR=/usr/include:${CLANG}/extra-includes \ > > -DFFI_INCLUDE_DIR:PATH=/usr/include \ > > -DLIBOMPTARGET_DEP_LIBFFI_LIBRARIES=${CLANG}/extra-libs/libffi.so \ > > -DCMAKE_C_COMPILER=gcc\ > > -DCMAKE_CXX_COMPILER=g++ \ > > -DLLVM_ENABLE_BACKTRACES=ON \ > > -DLLVM_ENABLE_WERROR=OFF \ > > -DLLVM_ENABLE_RTTI=ON \ > > -DLIBOMP_FORTRAN_MODULES=ON \ > > -DOPENMP_ENABLE_LIBOMPTARGET=ON \ > > -DLIBOMPTARGET_NVPTX_COMPUTE_CAPABILITIES=35,60,70 \ > > -DCLANG_OPENMP_NVPTX_DEFAULT_ARCH=sm_${COMPUTE_CAPABILITY}" > > > > > > Gabriele Jost > > > > ************************************************************************ > > Gabriele Jost NASA Ames Research Center > > Email: Gabriele.Jost at nasa.gov Mail Stop 258-6 > > Work Phone: (650) 604-0468 Bldg. 258, Rm. 232-4 > > Scientific & HPC Application P.O. Box 1 > > Development/Optimization Moffett Field, CA 94035-0001 > > ************************************************************************ > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev