-
-
Save matthiasdiener/e318e7ed8815872e9d29feb3b9c8413f to your computer and use it in GitHub Desktop.
#!/bin/bash | |
# | |
# Build GCC with support for offloading to NVIDIA GPUs. | |
# | |
set -o nounset -o errexit | |
# Location of the installed CUDA toolkit | |
cuda=/usr/local/cuda | |
# directory of this script | |
MYDIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
work_dir=$MYDIR/gcc-offload | |
install_dir=$work_dir/install | |
rm -rf $work_dir | |
# Build assembler and linking tools | |
mkdir -p $work_dir | |
cd $work_dir | |
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 | |
make install | |
cd .. | |
# Set up the GCC source tree | |
git clone https://github.com/MentorEmbedded/nvptx-newlib | |
wget -c http://gnu.mirror.globo.tech/gcc/gcc-7.3.0/gcc-7.3.0.tar.gz | |
tar xf gcc-7.3.0.tar.gz | |
cd gcc-7.3.0 | |
contrib/download_prerequisites | |
ln -s ../nvptx-newlib/newlib newlib | |
target=$(./config.guess) | |
cd .. | |
# Build nvptx GCC | |
mkdir build-nvptx-gcc | |
cd build-nvptx-gcc | |
../gcc-7.3.0/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 -j4 | |
make install | |
cd .. | |
# Build host GCC | |
mkdir build-host-gcc | |
cd build-host-gcc | |
../gcc-7.3.0/configure \ | |
--enable-offload-targets=nvptx-none \ | |
--with-cuda-driver-include=$cuda/include \ | |
--with-cuda-driver-lib=$cuda/lib64 \ | |
--disable-bootstrap \ | |
--disable-multilib \ | |
--enable-languages="c,c++,fortran,lto" \ | |
--prefix=$install_dir | |
make -j4 | |
make install | |
cd .. |
Anyone who knows about this issue, please help. thanks.
This script is for OpenMP offloading support, I haven't tested it with OpenAcc at all.
Hello,
I have tried to launch your script and everything passes except for the make of the Build Host GCC.
I have the following error:
make[3]: *** [Makefile:539 : sanitizer_platform_limits_posix.lo] Erreur 1 make[3] : on quitte le répertoire « /DISK4/offload/build-host-gcc/x86_64-pc-linux-gnu/libsanitizer/sanitizer_common » make[2]: *** [Makefile:472 : install-recursive] Erreur 1 make[2] : on quitte le répertoire « /DISK4/offload/build-host-gcc/x86_64-pc-linux-gnu/libsanitizer » make[1]: *** [Makefile:12708 : install-target-libsanitizer] Erreur 2 make[1] : on quitte le répertoire « /DISK4/offload/build-host-gcc » make: *** [Makefile:2301 : install] Erreur 2
It's written in French but you can see the libraries that cause the errors.
Thanks,
Hello,
Is there any GPU version requirement for this, I mean for arithmetic or architectural requirements, etc.?
Thanks,
Hello, Is there any GPU version requirement for this, I mean for arithmetic or architectural requirements, etc.? Thanks,
I don't know - it must depend on gcc version etc.
hello
i installed gcc+nvptx using your script.
gcc compiler was installed normally, and I tried to compile a simple openACC FORTRAN program with gfortran.
but i get following errors:
Anyone who knows about this issue, please help.
thanks.