Hi gcc users,
as my question does not seem to find an audience, I could perhaps
rephrase it differently:
Has anyone successfully compiled GCC11 with offloading to modern Nvidia
GPU on RHEL8 / CentOS8 and, if so, could they show me a pointer for a
tutorial or some "how-to" documentation?
I was not able to find this or may be i misunderstand the process to do
this.
Thanks
Patrick
Le 08/12/2021 à 21:50, Patrick Begou a écrit :
Hi,
my goal is to compile GCC 11.2 with OpenACC and OpenMP offloading on
nividia A100 GPU.I found some tutorial on
https://kristerw.blogspot.com/2017/04/building-gcc-with-support-for-nvidia.html
but I think I hit the bug
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100289 as it fails with:
In file included from ../../../../gcc/libgcc/libgcov-merge.c:26:
../../../../gcc/libgcc/libgcov.h:49:10: fatal error: sys/mman.h:
No such file or directory
49 | #include <sys/mman.h>
| ^~~~~~~~~~~~
compilation terminated.
Is there a workaround for this "configure" problem as the bug will
not be addressed before GCC 11.3 ?
The beginning of my script to build GCC is provided below.
Thanks
Patrick
#!/bin/bash
module use --append /opt/nvidia/hpc_sdk/modulefiles
module load nvhpc/20.9
CC=$(which gcc)
CXX=$(which g++)
install_dir=/opt/GCC11.2
work_dir=/robin/data/begou/GCC11/GCC11.2-offload
cuda=/opt/nvidia/hpc_sdk/Linux_x86_64/20.9/cuda
mkdir -p $work_dir
cd $work_dir
# Build assembler and linking tools
git clone https://github.com/MentorEmbedded/nvptx-tools
cd nvptx-tools
./configure \
--with-cuda-driver-include=$cuda/include \
--with-cuda-driver-lib=$cuda/lib64 \
--prefix=$install_dir
make ||exit 1
make install || exit 1
cd ..
# Set up the GCC source tree
git clone git://sourceware.org/git/newlib-cygwin.git nvptx-newlib
git clone --branch releases/gcc-11 git://gcc.gnu.org/git/gcc.git gcc
cd gcc
contrib/download_prerequisites
ln -s ../nvptx-newlib/newlib newlib
cd ..
target=$(gcc/config.guess)
# Build nvptx GCC
mkdir build-nvptx-gcc
cd build-nvptx-gcc
../gcc/configure \
--target=nvptx-none
--with-build-time-tools=$install_dir/nvptx-none/bin \
--enable-as-accelerator-for=$target \
--disable-sjlj-exceptions \
--enable-newlib-io-long-long \
--enable-languages="c,c++,fortran,lto" \
--prefix=$install_dir
make
(and the last make command fails)