From 993618b5ef07321850c379d45e14258121e23d3e Mon Sep 17 00:00:00 2001 From: Ahmad Nawab Date: Fri, 11 Oct 2024 12:05:26 +0200 Subject: [PATCH] CI: update nvhpc to 23.5 --- .github/tools/bootstrap-nvhpc.sh | 15 +++++ .github/tools/install-nvhpc.sh | 107 ------------------------------- .github/workflows/build.yml | 11 ++-- 3 files changed, 21 insertions(+), 112 deletions(-) create mode 100644 .github/tools/bootstrap-nvhpc.sh delete mode 100755 .github/tools/install-nvhpc.sh diff --git a/.github/tools/bootstrap-nvhpc.sh b/.github/tools/bootstrap-nvhpc.sh new file mode 100644 index 000000000..e3d17099d --- /dev/null +++ b/.github/tools/bootstrap-nvhpc.sh @@ -0,0 +1,15 @@ +#!/bin/bash +set -euo pipefail +set -x + +# Set nvhpc version to default value if unset +: "${nvhpc_version:=21.9}" + +# Use Atlas' nvhpc installation script +wget https://raw.githubusercontent.com/ecmwf/atlas/develop/tools/install-nvhpc.sh +chmod +x install-nvhpc.sh + +# Install nvhpc +./install-nvhpc.sh --version $nvhpc_version --prefix "${GITHUB_WORKSPACE}/nvhpc-install" --tmpdir "${RUNNER_TEMP}" + +exit 0 diff --git a/.github/tools/install-nvhpc.sh b/.github/tools/install-nvhpc.sh deleted file mode 100755 index 8a8f33248..000000000 --- a/.github/tools/install-nvhpc.sh +++ /dev/null @@ -1,107 +0,0 @@ -#!/bin/sh - -# Install NVHPC -# https://github.com/nemequ/pgi-travis -# -# Originally written for Squash by -# Evan Nemerson. For documentation, bug reports, support requests, -# etc. please use . -# -# To the extent possible under law, the author(s) of this script have -# waived all copyright and related or neighboring rights to this work. -# See for -# details. - -version=21.9 - -TEMPORARY_FILES="${TMPDIR:-/tmp}" -export NVHPC_INSTALL_DIR=$(pwd)/nvhpc-install -export NVHPC_SILENT=true -while [ $# != 0 ]; do - case "$1" in - "--prefix") - export NVHPC_INSTALL_DIR="$2"; shift - ;; - "--tmpdir") - TEMPORARY_FILES="$2"; shift - ;; - "--verbose") - export NVHPC_SILENT=false; - ;; - "--version") - version="$2"; shift - ;; - *) - echo "Unrecognized argument '$1'" - exit 1 - ;; - esac - shift -done - -case "$(uname -m)" in - x86_64|ppc64le|aarch64) - ;; - *) - echo "Unknown architecture: $(uname -m)" >&2 - exit 1 - ;; -esac - -if [ -d "${NVHPC_INSTALL_DIR}" ]; then - if [[ $(find "${NVHPC_INSTALL_DIR}" -name "nvc" | wc -l) == 1 ]]; then - echo "NVHPC already installed at ${NVHPC_INSTALL_DIR}" - exit - fi -fi - -# Example download URL for version 21.9 -# https://developer.download.nvidia.com/hpc-sdk/21.9/nvhpc_2020_219_Linux_x86_64_cuda_11.0.tar.gz - -ver="$(echo $version | tr -d . )" -URL=$(curl -s "https://developer.nvidia.com/nvidia-hpc-sdk-$ver-downloads" | grep -oP "https://developer.download.nvidia.com/hpc-sdk/([0-9]{2}\.[0-9]+)/nvhpc_([0-9]{4})_([0-9]+)_Linux_$(uname -m)_cuda_([0-9\.]+).tar.gz" | sort | tail -1) -FOLDER="$(basename "$(echo "${URL}" | grep -oP '[^/]+$')" .tar.gz)" - -if [ ! -d "${TEMPORARY_FILES}/${FOLDER}" ]; then - echo "Downloading ${TEMPORARY_FILES}/${FOLDER} from URL [${URL}]" - mkdir -p ${TEMPORARY_FILES} - curl --location \ - --user-agent "pgi-travis (https://github.com/nemequ/pgi-travis)" \ - "${URL}" | tar zx -C "${TEMPORARY_FILES}" -else - echo "Download already present in ${TEMPORARY_FILES}/${FOLDER}" -fi - -echo "+ ${TEMPORARY_FILES}/${FOLDER}/install" -"${TEMPORARY_FILES}/${FOLDER}/install" - -#comment out to cleanup -#rm -rf "${TEMPORARY_FILES}/${FOLDER}" - -NVHPC_VERSION=$(basename "${NVHPC_INSTALL_DIR}"/Linux_$(uname -m)/*.*/) - -# Use gcc which is available in PATH -${NVHPC_INSTALL_DIR}/Linux_$(uname -m)/${NVHPC_VERSION}/compilers/bin/makelocalrc \ - -x ${NVHPC_INSTALL_DIR}/Linux_$(uname -m)/${NVHPC_VERSION}/compilers/bin \ - -gcc $(which gcc) \ - -gpp $(which g++) \ - -g77 $(which gfortran) - -cat > ${NVHPC_INSTALL_DIR}/env.sh << EOF -### Variables -export NVHPC_INSTALL_DIR=${NVHPC_INSTALL_DIR} -export NVHPC_VERSION=${NVHPC_VERSION} -export NVHPC_DIR=\${NVHPC_INSTALL_DIR}/Linux_$(uname -m)/\${NVHPC_VERSION} - -### Compilers -export PATH=\${NVHPC_DIR}/compilers/bin:\${PATH} -export NVHPC_LIBRARY_PATH=\${NVHPC_DIR}/compilers/lib -export LD_LIBRARY_PATH=\${NVHPC_LIBRARY_PATH} - -### MPI -export MPI_HOME=\${NVHPC_DIR}/comm_libs/mpi -export PATH=\${MPI_HOME}/bin:\${PATH} -EOF - -cat ${NVHPC_INSTALL_DIR}/env.sh - diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 91db19cf6..a8b8a439b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,7 +35,7 @@ jobs: name: - linux gnu-10 - linux gnu-14 - - linux nvhpc-21.9 + - linux nvhpc-23.5 - linux intel-classic - macos @@ -59,9 +59,9 @@ jobs: python-version: '3.11' caching: true - - name: linux nvhpc-21.9 + - name: linux nvhpc-23.5 os: ubuntu-20.04 - compiler: nvhpc-21.9 + compiler: nvhpc-23.5 compiler_cc: nvc compiler_cxx: nvc++ compiler_fc: nvfortran @@ -139,13 +139,14 @@ jobs: - name: Install NVHPC compiler if: contains( matrix.compiler, 'nvhpc' ) shell: bash -eux {0} + env: + nvhpc_version: 23.5 run: | - ${ECWAM_TOOLS}/install-nvhpc.sh --prefix /opt/nvhpc + ${ECWAM_TOOLS}/bootstrap-nvhpc.sh source /opt/nvhpc/env.sh echo "${NVHPC_DIR}/compilers/bin" >> $GITHUB_PATH [ -z ${MPI_HOME+x} ] || echo "MPI_HOME=${MPI_HOME}" >> $GITHUB_ENV echo "localhost slots=72" >> ${MPI_HOME}/etc/openmpi-default-hostfile - echo "ECWAM_LAUNCH_SERIAL_MPI=1" >> $GITHUB_ENV - name: Install Intel oneAPI compiler