Skip to content

Commit 6a0e74e

Browse files
committed
Github action: add CI for using OpenMPI
1 parent 2013eed commit 6a0e74e

File tree

1 file changed

+116
-0
lines changed

1 file changed

+116
-0
lines changed

.github/workflows/openmpi.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: Using OpenMPI
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths-ignore:
7+
- '**/*.md'
8+
- '**/*.txt'
9+
pull_request:
10+
branches:
11+
- main
12+
paths-ignore:
13+
- '**/*.md'
14+
- '**/*.txt'
15+
16+
jobs:
17+
build-linux:
18+
name: Python (${{ matrix.python-version }})
19+
runs-on: ubuntu-latest
20+
timeout-minutes: 60
21+
env:
22+
OPENMPI_VERSION: 5.0.7
23+
OPENMPI_DIR: ${{ github.workspace }}/ompi-install
24+
PNETCDF_VERSION: 1.14.0
25+
PNETCDF_DIR: ${{ github.workspace }}/PnetCDF-install
26+
strategy:
27+
matrix:
28+
python-version: ["3.10"]
29+
steps:
30+
31+
- uses: actions/checkout@v4
32+
33+
- name: Set up Python ${{ matrix.python-version }}
34+
uses: actions/setup-python@v4
35+
with:
36+
python-version: ${{ matrix.python-version }}
37+
38+
- name: Install Ubuntu Dependencies
39+
run: |
40+
sudo apt-get update
41+
sudo apt-get install m4
42+
43+
- name: Build OPENMPI
44+
run: |
45+
echo "Install OpenMPI ${OPENMPI_VERSION} in $OPENMPI_DIR"
46+
VER_MAJOR=${OPENMPI_VERSION%.*}
47+
rm -rf OPENMPI ; mkdir OPENMPI ; cd OPENMPI
48+
wget -q https://download.open-mpi.org/release/open-mpi/v${VER_MAJOR}/openmpi-${OPENMPI_VERSION}.tar.gz
49+
gzip -dc openmpi-${OPENMPI_VERSION}.tar.gz | tar -xf -
50+
cd openmpi-${OPENMPI_VERSION}
51+
./configure --prefix=$OPENMPI_DIR \
52+
--with-io-romio-flags="--with-file-system=ufs" \
53+
--with-hwloc=internal \
54+
--with-pmix=internal \
55+
--with-libevent=internal \
56+
--disable-mpi-fortran \
57+
CC=gcc
58+
make -s LIBTOOLFLAGS=--silent V=1 -j 4 install > qout 2>&1
59+
make -s -j 4 distclean >> qout 2>&1
60+
61+
- name: Build PnetCDF-C official release
62+
run: |
63+
echo "Download and build PnetCDF-C release version ${PNETCDF_VERSION}"
64+
wget -q https://parallel-netcdf.github.io/Release/pnetcdf-${PNETCDF_VERSION}.tar.gz
65+
tar -xzf pnetcdf-${PNETCDF_VERSION}.tar.gz
66+
pushd pnetcdf-${PNETCDF_VERSION}
67+
./configure --prefix=$PNETCDF_DIR \
68+
--silent \
69+
--enable-shared \
70+
--enable-debug \
71+
--disable-fortran \
72+
--disable-cxx \
73+
--with-mpi=$OPENMPI_DIR
74+
make -s LIBTOOLFLAGS=--silent V=1 -j 4 install > qout 2>&1
75+
make -s -j 4 distclean >> qout 2>&1
76+
popd
77+
78+
- name: Install python dependencies via pip
79+
run: |
80+
python -m pip install --upgrade pip setuptools wheel
81+
pip install numpy cython cftime pytest twine check-manifest
82+
export MPICC=$OPENMPI_DIR/bin/mpicc
83+
pip install mpi4py
84+
pip install torch torchvision
85+
86+
- name: Install PnetCDF-Python
87+
run: |
88+
export CC=$OPENMPI_DIR/bin/mpicc
89+
pip install --verbose --no-build-isolation -e .
90+
91+
- name: Test PnetCDF-Python
92+
run: |
93+
export PATH=${OPENMPI_DIR}/bin:${PATH}
94+
make ptests TESTMPIRUN="${OPENMPI_DIR}/bin/mpiexec --oversubscribe"
95+
96+
- name: Re-install PnetCDF-Python from source distribution
97+
run: |
98+
pip uninstall -y pnetcdf
99+
make install-clean
100+
export CC=$OPENMPI_DIR/bin/mpicc
101+
python setup.py sdist
102+
pip install --verbose dist/pnetcdf-*.tar.gz
103+
104+
- name: Test PnetCDF-Python
105+
run: |
106+
export PATH=${OPENMPI_DIR}/bin:${PATH}
107+
make ptests TESTMPIRUN="${OPENMPI_DIR}/bin/mpiexec --oversubscribe"
108+
109+
# - name: Tarball
110+
# run: |
111+
# export PATH=${NETCDF_DIR}/bin:${PATH}
112+
# python setup.py --version
113+
# check-manifest --version
114+
# check-manifest --verbose
115+
# pip wheel . -w dist --no-deps
116+
# twine check dist/*

0 commit comments

Comments
 (0)