compiler errors – GCC 11.2.0 Installation with nvptx-tools Fails on CentOS 7: ‘ACCEL_COMPILER_acc_device’ Not Declared

I am trying to run OpenACC code on a GPU and need to use GCC for compiling the C++ code. Specifically, I am attempting to install GCC 11.2.0 with nvptx-tools on a cluster running CentOS 7. The compute node has a V100 GPU.

I used the following commands for installation:

# Install nvptx-tools
git clone https://github.com/MentorEmbedded/nvptx-tools.git
cd nvptx-tools
./configure --prefix=/hpc/packages/minerva-centos7/gcc/11.2.0_openacc/nvptx-tools
make
make install

# Install GCC
wget https://ftp.gnu.org/gnu/gcc/gcc-11.2.0/gcc-11.2.0.tar.gz
tar -xf gcc-11.2.0.tar.gz
cd gcc-11.2.0

./contrib/download_prerequisites

mkdir build
cd build

../configure --prefix=$HOME/gcc-11.2.0 \
             --enable-languages=c,c++,fortran \
             --disable-multilib \
             --enable-offload-targets=nvptx-none \
             --with-cuda-driver-include=$HOME/cuda/include \
             --with-cuda-driver-lib=$HOME/cuda/lib64 \
             --with-build-time-tools=$HOME/nvptx-tools/bin \
             --enable-as-accelerator-for=$(../config.guess) \
             --enable-checking=release \
             --disable-bootstrap \
             --with-system-zlib \
             --disable-werror

make

After running the make command for some time, I encounter the following error:

...................
../../gcc/gimple-fold.c:3846:29: warning: missing initializer for member ‘c_strlen_data::maxlen’ [-Wmissing-field-initializers]
../../gcc/gimple-fold.c:3846:29: warning: missing initializer for member ‘c_strlen_data::maxbound’ [-Wmissing-field-initializers]
../../gcc/gimple-fold.c:3846:29: warning: missing initializer for member ‘c_strlen_data::decl’ [-Wmissing-field-initializers]
../../gcc/gimple-fold.c:3846:29: warning: missing initializer for member ‘c_strlen_data::off’ [-Wmissing-field-initializers]
../../gcc/gimple-fold.c: In function ‘bool gimple_fold_builtin_acc_on_device(gimple_stmt_iterator*, tree)’:
../../gcc/gimple-fold.c:3900:13: error: ‘ACCEL_COMPILER_acc_device’ was not declared in this scope
   val_dev = ACCEL_COMPILER_acc_device;
             ^
make[2]: *** [gimple-fold.o] Error 1
make[2]: Leaving directory `/hpc/packages/minerva-centos7/gcc/11.2.0_openacc/gcc-11.2.0/build/gcc'
make[1]: *** [all-gcc] Error 2
make[1]: Leaving directory `/hpc/packages/minerva-centos7/gcc/11.2.0_openacc/gcc-11.2.0/build'
make: *** [all] Error 2

I tried running the installation on the compute node as well, but I am getting the same error. Could you please help me resolve this issue?

Thanks in advance!

Read more here: Source link