Skip to content

Commit 0c6d1e0

Browse files
committed
ECLand: Add Intel, NVHPC and MacOS testing to CI setup
1 parent d9f8647 commit 0c6d1e0

File tree

3 files changed

+219
-3
lines changed

3 files changed

+219
-3
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
3+
version=2023.2.0
4+
KEY=GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
5+
wget https://apt.repos.intel.com/intel-gpg-keys/$KEY
6+
sudo apt-key add $KEY
7+
rm $KEY
8+
echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
9+
sudo apt-get update
10+
sudo apt-get install \
11+
intel-oneapi-compiler-fortran-$version \
12+
intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-$version \
13+
intel-oneapi-mpi-devel-2021.10.0 \
14+
intel-oneapi-mkl-$version

.github/tools/install-nvhpc.sh

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
#!/bin/sh
2+
3+
# Install NVHPC
4+
# https://github.com/nemequ/pgi-travis
5+
#
6+
# Originally written for Squash <https://github.com/quixdb/squash> by
7+
# Evan Nemerson. For documentation, bug reports, support requests,
8+
# etc. please use <https://github.com/nemequ/pgi-travis>.
9+
#
10+
# To the extent possible under law, the author(s) of this script have
11+
# waived all copyright and related or neighboring rights to this work.
12+
# See <https://creativecommons.org/publicdomain/zero/1.0/> for
13+
# details.
14+
15+
version=21.9
16+
17+
TEMPORARY_FILES="${TMPDIR:-/tmp}"
18+
export NVHPC_INSTALL_DIR=$(pwd)/nvhpc-install
19+
export NVHPC_SILENT=true
20+
while [ $# != 0 ]; do
21+
case "$1" in
22+
"--prefix")
23+
export NVHPC_INSTALL_DIR="$2"; shift
24+
;;
25+
"--tmpdir")
26+
TEMPORARY_FILES="$2"; shift
27+
;;
28+
"--verbose")
29+
export NVHPC_SILENT=false;
30+
;;
31+
"--version")
32+
version="$2"; shift
33+
;;
34+
*)
35+
echo "Unrecognized argument '$1'"
36+
exit 1
37+
;;
38+
esac
39+
shift
40+
done
41+
42+
case "$(uname -m)" in
43+
x86_64|ppc64le|aarch64)
44+
;;
45+
*)
46+
echo "Unknown architecture: $(uname -m)" >&2
47+
exit 1
48+
;;
49+
esac
50+
51+
if [ -d "${NVHPC_INSTALL_DIR}" ]; then
52+
if [[ $(find "${NVHPC_INSTALL_DIR}" -name "nvc" | wc -l) == 1 ]]; then
53+
echo "NVHPC already installed at ${NVHPC_INSTALL_DIR}"
54+
exit
55+
fi
56+
fi
57+
58+
# Example download URL for version 21.9
59+
# https://developer.download.nvidia.com/hpc-sdk/21.9/nvhpc_2020_219_Linux_x86_64_cuda_11.0.tar.gz
60+
61+
ver="$(echo $version | tr -d . )"
62+
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)
63+
FOLDER="$(basename "$(echo "${URL}" | grep -oP '[^/]+$')" .tar.gz)"
64+
65+
if [ ! -d "${TEMPORARY_FILES}/${FOLDER}" ]; then
66+
echo "Downloading ${TEMPORARY_FILES}/${FOLDER} from URL [${URL}]"
67+
mkdir -p ${TEMPORARY_FILES}
68+
curl --location \
69+
--user-agent "pgi-travis (https://github.com/nemequ/pgi-travis)" \
70+
"${URL}" | tar zx -C "${TEMPORARY_FILES}"
71+
else
72+
echo "Download already present in ${TEMPORARY_FILES}/${FOLDER}"
73+
fi
74+
75+
echo "+ ${TEMPORARY_FILES}/${FOLDER}/install"
76+
"${TEMPORARY_FILES}/${FOLDER}/install"
77+
78+
#comment out to cleanup
79+
#rm -rf "${TEMPORARY_FILES}/${FOLDER}"
80+
81+
NVHPC_VERSION=$(basename "${NVHPC_INSTALL_DIR}"/Linux_$(uname -m)/*.*/)
82+
83+
# Use gcc which is available in PATH
84+
${NVHPC_INSTALL_DIR}/Linux_$(uname -m)/${NVHPC_VERSION}/compilers/bin/makelocalrc \
85+
-x ${NVHPC_INSTALL_DIR}/Linux_$(uname -m)/${NVHPC_VERSION}/compilers/bin \
86+
-gcc $(which gcc) \
87+
-gpp $(which g++) \
88+
-g77 $(which gfortran)
89+
90+
cat > ${NVHPC_INSTALL_DIR}/env.sh << EOF
91+
### Variables
92+
export NVHPC_INSTALL_DIR=${NVHPC_INSTALL_DIR}
93+
export NVHPC_VERSION=${NVHPC_VERSION}
94+
export NVHPC_DIR=\${NVHPC_INSTALL_DIR}/Linux_$(uname -m)/\${NVHPC_VERSION}
95+
96+
### Compilers
97+
export PATH=\${NVHPC_DIR}/compilers/bin:\${PATH}
98+
export NVHPC_LIBRARY_PATH=\${NVHPC_DIR}/compilers/lib
99+
export LD_LIBRARY_PATH=\${NVHPC_LIBRARY_PATH}
100+
101+
### MPI
102+
export MPI_HOME=\${NVHPC_DIR}/comm_libs/mpi
103+
export PATH=\${MPI_HOME}/bin:\${PATH}
104+
EOF
105+
106+
cat ${NVHPC_INSTALL_DIR}/env.sh
107+

.github/workflows/build.yml

Lines changed: 98 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ jobs:
3434
prec: ['DP', 'SP']
3535
name:
3636
- linux gnu-10
37+
- linux nvhpc-23.5
38+
- linux intel-classic
39+
- macos
3740

3841
include:
3942

@@ -47,6 +50,35 @@ jobs:
4750
python-version: '3.8'
4851
caching: true
4952

53+
- name: linux nvhpc-23.5
54+
os: ubuntu-20.04
55+
compiler: nvhpc-23.5
56+
compiler_cc: nvc
57+
compiler_cxx: nvc++
58+
compiler_fc: nvfortran
59+
cmake_options: -DCMAKE_CXX_FLAGS=--diag_suppress177
60+
python-version: '3.8'
61+
caching: true
62+
63+
- name : linux intel-classic
64+
os: ubuntu-20.04
65+
compiler: intel-classic
66+
compiler_cc: icc
67+
compiler_cxx: icpc
68+
compiler_fc: ifort
69+
python-version: '3.8'
70+
caching: true
71+
72+
- name: macos
73+
# Xcode compiler requires empty environment variables, so we pass null (~) here
74+
os: macos-13
75+
compiler: clang-14
76+
compiler_cc: ~
77+
compiler_cxx: ~
78+
compiler_fc: gfortran-13
79+
python-version: '3.11'
80+
caching: true
81+
5082
runs-on: ${{ matrix.os }}
5183
steps:
5284
- name: Set up Python ${{ matrix.python-version }}
@@ -64,14 +96,77 @@ jobs:
6496
echo "CXX=${{ matrix.compiler_cxx }}" >> $GITHUB_ENV
6597
echo "FC=${{ matrix.compiler_fc }}" >> $GITHUB_ENV
6698
67-
sudo apt-get update
68-
sudo apt-get install ninja-build
69-
sudo apt-get install libnetcdff-dev
99+
if [[ "${{ matrix.os }}" =~ macos ]]; then
100+
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
101+
export HOMEBREW_NO_AUTO_UPDATE=1
102+
export HOMEBREW_NO_INSTALL_CLEANUP=1
103+
export SDKROOT=$(xcrun --show-sdk-path)
104+
echo "HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1" >> $GITHUB_ENV
105+
echo "HOMEBREW_NO_AUTO_UPDATE=1" >> $GITHUB_ENV
106+
echo "HOMEBREW_NO_INSTALL_CLEANUP=1" >> $GITHUB_ENV
107+
echo "SDKROOT=$(xcrun --show-sdk-path)" >> $GITHUB_ENV
108+
brew install ninja
109+
brew install libomp
110+
brew install netcdf-fortran
111+
brew install coreutils
112+
else
113+
sudo apt-get update
114+
sudo apt-get install ninja-build
115+
sudo apt-get install libnetcdff-dev
116+
fi
70117
71118
pip3 install numpy
72119
73120
printenv
74121
122+
- name: Cache Dependencies
123+
# There seems to be a problem with cached NVHPC dependencies,
124+
# leading to SIGILL perhaps due to slightly different architectures
125+
if: matrix.caching
126+
id: deps-cache
127+
uses: pat-s/[email protected]
128+
with:
129+
path: ${{ env.DEPS_DIR }}
130+
key: deps-${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.build_type }}-${{ env.CACHE_SUFFIX }}
131+
132+
# Free up disk space for nvhpc
133+
- name: Free Disk Space (Ubuntu)
134+
uses: jlumbroso/free-disk-space@main
135+
if: contains( matrix.compiler, 'nvhpc' )
136+
continue-on-error: true
137+
with:
138+
# this might remove tools that are actually needed,
139+
# if set to "true" but frees about 6 GB
140+
tool-cache: false
141+
142+
# all of these default to true, but feel free to set to
143+
# "false" if necessary for your workflow
144+
android: true
145+
dotnet: true
146+
haskell: true
147+
large-packages: true
148+
docker-images: true
149+
swap-storage: true
150+
151+
- name: Install NVHPC compiler
152+
if: contains( matrix.compiler, 'nvhpc' )
153+
shell: bash -eux {0}
154+
run: |
155+
${ECLAND_TOOLS}/install-nvhpc.sh --prefix /opt/nvhpc --version 23.5
156+
source /opt/nvhpc/env.sh
157+
echo "${NVHPC_DIR}/compilers/bin" >> $GITHUB_PATH
158+
[ -z ${MPI_HOME+x} ] || echo "MPI_HOME=${MPI_HOME}" >> $GITHUB_ENV
159+
echo "localhost slots=72" >> ${MPI_HOME}/etc/openmpi-default-hostfile
160+
echo "ECLAND_LAUNCH_SERIAL_MPI=1" >> $GITHUB_ENV
161+
162+
- name: Install Intel oneAPI compiler
163+
if: contains( matrix.compiler, 'intel' )
164+
run: |
165+
${ECLAND_TOOLS}/install-intel-oneapi.sh
166+
source /opt/intel/oneapi/setvars.sh
167+
printenv >> $GITHUB_ENV
168+
echo "CACHE_SUFFIX=$CC-$($CC -dumpversion)" >> $GITHUB_ENV
169+
75170
- name: Install MPI
76171
shell: bash -eux {0}
77172
run: |

0 commit comments

Comments
 (0)