[llvm-dev] building with openmp target nvptx with llvm 12 versus 11

156 views
Skip to first unread message

KESTENER Pierre via llvm-dev

unread,
Apr 29, 2021, 12:13:12 PM4/29/21
to llvm...@lists.llvm.org
Hello,

I have succesfully built and used clang with OpenMP offload target for Nivida architecture (sm_80) using llvm-11.0.1 release sources.

However, using release 12.0.0, I have a strange compile error.

Here is how I configure the openmp support with cmake:
ccmake -DCLANG_OPENMP_NVPTX_DEFAULT_ARCH=sm_80 -DLIBOMPTARGET_NVPTX_COMPUTE_CAPABILITIES=80 -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;libcxx;libcxxabi;lld;openmp" -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/opt/local/llvm-12-omptarget -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ../openmp

here clang and clang++ are actually clang-12 and clang++-12 (built previously, I crossed check that I was able to compile cuda code, it is ok).

The compile error in building openmp support is

[ 24%] Building LLVM bitcode target_impl.cu-cuda_112-sm_80.bc
cd /home/kestener/install/llvm/llvm-project-llvmorg-12.0.0/build-openmp/libomptarget/deviceRTLs/nvptx && /opt/local/llvm-12-omptarget/bin/clang -S -x c++ -O1 -std=c++14 -target nvptx64 -Xclang -emit-llvm-bc -Xclang -aux-triple -Xclang x86_64-unknown-linux-gnu -fopenmp -fopenmp-cuda-mode -Xclang -fopenmp-is-device -D__CUDACC__ -I/home/kestener/install/llvm/llvm-project-llvmorg-12.0.0/openmp/libomptarget/deviceRTLs -I/home/kestener/install/llvm/llvm-project-llvmorg-12.0.0/openmp/libomptarget/deviceRTLs/nvptx/src -DOMPTARGET_NVPTX_DEBUG=0 -Xclang -target-cpu -Xclang sm_80 -D__CUDA_ARCH__=800 -Xclang -target-feature -Xclang +ptx70 -DCUDA_VERSION=11200 /home/kestener/install/llvm/llvm-project-llvmorg-12.0.0/openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu -o target_impl.cu-cuda_112-sm_80.bc
In file included from /home/kestener/install/llvm/llvm-project-llvmorg-12.0.0/openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu:14:
In file included from /home/kestener/install/llvm/llvm-project-llvmorg-12.0.0/openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h:15:
In file included from /usr/include/assert.h:35:
/usr/include/features.h:461:12: fatal error: 'sys/cdefs.h' file not found
# include <sys/cdefs.h>
^~~~~~~~~~~~~

I don't know why this header is not found, it is actually present in my system (Ubuntu 20.04)

Did I miss something here ? It was building fine with llvm-11.0.1.

Thanks for your help.

Pierre
_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

Johannes Doerfert via llvm-dev

unread,
Apr 30, 2021, 11:28:09 AM4/30/21
to KESTENER Pierre, llvm...@lists.llvm.org, Luo, Ye
This was an oversight and we'll make sure the runtime will be
freestanding in the future.
That said, Ye Luo fixed this by installing gcc-multilib, maybe that
helps you too.

If not, we'll have to come up with a hotfix.

~ Johannes

KESTENER Pierre via llvm-dev

unread,
Apr 30, 2021, 11:51:34 AM4/30/21
to Johannes Doerfert, llvm...@lists.llvm.org, Luo, Ye
Dear Johannes,

thanks for your answer.
Yes gcc-multilib was necessary, silly of me !
The build is ok now.

Best regards.

________________________________________
De : Johannes Doerfert [johannes...@gmail.com]
Envoyé : vendredi 30 avril 2021 17:27
À : KESTENER Pierre; llvm...@lists.llvm.org; Luo, Ye
Objet : Re: [llvm-dev] building with openmp target nvptx with llvm 12 versus 11

Reply all
Reply to author
Forward
0 new messages