Skip to content

Commit 9eef568

Browse files
committed
Github actions: use matrix to merge build options
1 parent d9b56e9 commit 9eef568

4 files changed

Lines changed: 186 additions & 423 deletions

File tree

.github/workflows/main.yml

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
name: Test PnetCDF-C master branch
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
workflow_dispatch:
8+
inputs:
9+
reason:
10+
description: 'Enable manual run because PnetCDF is updated more frequently'
11+
required: false
12+
default: 'Manual trigger'
13+
push:
14+
branches:
15+
- main
16+
paths-ignore:
17+
- '**/*.md'
18+
- '**/*.txt'
19+
pull_request:
20+
branches:
21+
- main
22+
paths-ignore:
23+
- '**/*.md'
24+
- '**/*.txt'
25+
26+
env:
27+
MPICH_VERSION: 4.3.2
28+
OPENMPI_VERSION: 5.0.9
29+
PNETCDF_VERSION: 1.14.1
30+
LIBTOOL_VERSION: 2.5.4
31+
MPI_DIR: ${{ github.workspace }}/MPI
32+
PNETCDF_DIR: ${{ github.workspace }}/PnetCDF-install
33+
34+
jobs:
35+
build:
36+
strategy:
37+
fail-fast: false # This disables the default cancel-on-failure behavior
38+
matrix:
39+
mpi_vendor: [ MPICH, OpenMPI ]
40+
pnetcdf_ver: [ release, master ]
41+
42+
runs-on: ubuntu-latest
43+
timeout-minutes: 60
44+
45+
steps:
46+
47+
- uses: actions/checkout@v4
48+
49+
- name: Set up Python 3.10
50+
uses: actions/setup-python@v4
51+
with:
52+
python-version: 3.10
53+
54+
- name: Install Ubuntu Dependencies
55+
run: |
56+
sudo apt-get update
57+
sudo apt-get install automake autoconf libtool libtool-bin m4
58+
59+
- name: Install GNU autotools
60+
run: |
61+
sudo apt-get update
62+
sudo apt-get install autoconf
63+
sudo apt-get install automake
64+
sudo apt-get install m4
65+
66+
wget -q https://ftp.gnu.org/gnu/libtool/libtool-${LIBTOOL_VERSION}.tar.gz
67+
gzip -dc libtool-${LIBTOOL_VERSION}.tar.gz | tar -xf -
68+
cd libtool-${LIBTOOL_VERSION}
69+
./configure --prefix=/usr --silent
70+
sudo make -s LIBTOOLFLAGS=--silent V=1 -j 8 install > qout 2>&1
71+
sudo make -s LIBTOOLFLAGS=--silent V=1 -j 8 distclean >> qout 2>&1
72+
73+
- name: Install MPI compiler vendor - ${{ matrix.mpi_vendor }}
74+
run: |
75+
set -x
76+
if test "${{ matrix.mpi_vendor }}" = "MPICH" ; then
77+
# MPICH versions older than 4.2.2 do not support the MPI large
78+
# count feature.
79+
echo "Install MPICH ${MPICH_VERSION} in ${GITHUB_WORKSPACE}/MPI"
80+
wget -q https://www.mpich.org/static/downloads/${MPICH_VERSION}/mpich-${MPICH_VERSION}.tar.gz
81+
gzip -dc mpich-${MPICH_VERSION}.tar.gz | tar -xf -
82+
cd mpich-${MPICH_VERSION}
83+
./configure --prefix=${MPI_DIR} \
84+
--silent \
85+
--enable-romio \
86+
--with-file-system=ufs \
87+
--with-device=ch3:sock \
88+
--disable-fortran \
89+
CC=gcc
90+
make -s LIBTOOLFLAGS=--silent V=1 -j 8 install
91+
make -s LIBTOOLFLAGS=--silent V=1 -j 8 distclean
92+
else # OpenMPI
93+
echo "Install OpenMPI ${OPENMPI_VERSION} in ${GITHUB_WORKSPACE}/MPI"
94+
VER_MAJOR=${OPENMPI_VERSION%.*}
95+
wget -q https://download.open-mpi.org/release/open-mpi/v${VER_MAJOR}/openmpi-${OPENMPI_VERSION}.tar.gz
96+
gzip -dc openmpi-${OPENMPI_VERSION}.tar.gz | tar -xf -
97+
cd openmpi-${OPENMPI_VERSION}
98+
./configure --prefix=${MPI_DIR} \
99+
--silent \
100+
--with-io-romio-flags="--with-file-system=ufs" \
101+
--disable-mpi-fortran \
102+
CC=gcc
103+
make -s LIBTOOLFLAGS=--silent V=1 -j 8 install
104+
make -s LIBTOOLFLAGS=--silent V=1 -j 8 distclean
105+
fi
106+
107+
- name: Build PnetCDF-C from ${{ matrix.pnetcdf_ver }}
108+
run: |
109+
set -x
110+
cd ${GITHUB_WORKSPACE}
111+
export PATH="${MPI_DIR}/bin:${PATH}"
112+
export LD_LIBRARY_PATH="${MPI_DIR}/lib:${LD_LIBRARY_PATH}"
113+
m4 --version
114+
autoconf --version
115+
automake --version
116+
libtool --version
117+
118+
if test "${{ matrix.pnetcdf_ver }}" = "master" ; then
119+
git clone -q https://github.com/Parallel-NetCDF/PnetCDF.git
120+
pushd PnetCDF
121+
autoreconf -i
122+
else
123+
wget -q https://parallel-netcdf.github.io/Release/pnetcdf-${PNETCDF_VERSION}.tar.gz
124+
tar -xzf pnetcdf-${PNETCDF_VERSION}.tar.gz
125+
pushd pnetcdf-${PNETCDF_VERSION}
126+
fi
127+
./configure --prefix=$PNETCDF_DIR \
128+
--silent \
129+
--enable-shared \
130+
--enable-debug \
131+
--disable-fortran \
132+
--disable-cxx \
133+
--with-mpi=$MPI_DIR
134+
make -s LIBTOOLFLAGS=--silent V=1 -j 4 install > qout 2>&1
135+
make -s -j 4 distclean >> qout 2>&1
136+
popd
137+
138+
- name: Install python dependencies via pip
139+
run: |
140+
python -m pip install --upgrade pip setuptools wheel
141+
pip install numpy cython cftime pytest twine check-manifest
142+
export MPICC=$MPI_DIR/bin/mpicc
143+
export CC=$MPI_DIR/bin/mpicc
144+
pip install mpi4py
145+
pip install torch torchvision
146+
147+
- name: Install PnetCDF-Python
148+
run: |
149+
export CC=$MPI_DIR/bin/mpicc
150+
pip install --verbose --no-build-isolation -e .
151+
152+
- name: Test PnetCDF-Python
153+
run: |
154+
export PATH=${PNETCDF_DIR}/bin:${MPI_DIR}/bin:${PATH}
155+
export LD_LIBRARY_PATH="${PNETCDF_DIR}/lib:${MPI_DIR}/lib:${LD_LIBRARY_PATH}"
156+
if test "${{ matrix.mpi_vendor }}" = "OpenMPI" ; then
157+
make ptests TESTMPIRUN="${MPI_DIR}/bin/mpiexec --oversubscribe"
158+
else
159+
make ptests TESTMPIRUN="${MPI_DIR}/bin/mpiexec"
160+
fi
161+
162+
- name: Re-install PnetCDF-Python from source distribution
163+
run: |
164+
pip uninstall -y pnetcdf
165+
make install-clean
166+
export CC=$MPI_DIR/bin/mpicc
167+
python setup.py sdist
168+
pip install --verbose dist/pnetcdf-*.tar.gz
169+
170+
- name: Test PnetCDF-Python
171+
run: |
172+
export PATH=${PNETCDF_DIR}/bin:${MPI_DIR}/bin:${PATH}
173+
export LD_LIBRARY_PATH="${PNETCDF_DIR}/lib:${MPI_DIR}/lib:${LD_LIBRARY_PATH}"
174+
if test "${{ matrix.mpi_vendor }}" = "OpenMPI" ; then
175+
make ptests TESTMPIRUN="${MPI_DIR}/bin/mpiexec --oversubscribe"
176+
else
177+
make ptests TESTMPIRUN="${MPI_DIR}/bin/mpiexec"
178+
fi
179+
# - name: Tarball
180+
# run: |
181+
# export PATH=${NETCDF_DIR}/bin:${PATH}
182+
# python setup.py --version
183+
# check-manifest --version
184+
# check-manifest --verbose
185+
# pip wheel . -w dist --no-deps
186+
# twine check dist/*

.github/workflows/openmpi.yml

Lines changed: 0 additions & 123 deletions
This file was deleted.

0 commit comments

Comments
 (0)