Skip to content

Commit c8fba35

Browse files
committed
GHA: Fix CI issues
1 parent c5fee86 commit c8fba35

File tree

7 files changed

+133
-102
lines changed

7 files changed

+133
-102
lines changed

.github/workflows/main.yml

+61-19
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,71 @@
1-
name: github-CI
1+
name: main
22

3-
on: [push]
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
workflow_dispatch:
411

512
jobs:
6-
build:
7-
13+
test:
814
runs-on: ${{ matrix.os }}
915
strategy:
16+
fail-fast: false
1017
matrix:
11-
os: [ubuntu-latest, macos-latest]
12-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
13-
name: Python ${{ matrix.python-version }} example
18+
os:
19+
- ubuntu-latest
20+
- macos-latest
21+
mpi:
22+
- mpich
23+
- openmpi
24+
py:
25+
# - "3.7"
26+
# - "3.8"
27+
# - "3.9"
28+
- "3.10"
29+
- "3.11"
30+
- "3.12"
1431

1532
steps:
16-
- uses: actions/checkout@v3
17-
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
18-
- name: setup-conda
19-
uses: s-weigand/setup-conda@v1
33+
34+
- uses: actions/checkout@v4
35+
36+
- uses: actions/setup-python@v5
2037
with:
21-
update-conda: true
22-
python-version: ${{ matrix.python-version }}
23-
conda-channels: anaconda, conda-forge
24-
- run: conda --version
25-
- run: which python
38+
python-version: ${{ matrix.py }}
39+
2640
- run: |
27-
conda config --set always_yes yes
28-
conda install -n root conda-build numpy fftw
29-
conda build ./conf
41+
# Install fftw
42+
case $(uname) in
43+
Linux)
44+
sudo apt update
45+
sudo apt install -y -q libfftw3-dev
46+
#echo FFTW_INCLUDE_DIR=/usr/include >> $GITHUB_ENV
47+
#echo FFTW_LIBRARY_DIR=/usr/lib/x86_64-linux-gnu >> $GITHUB_ENV
48+
;;
49+
Darwin)
50+
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
51+
brew install fftw
52+
prefix=$(brew --prefix fftw)
53+
#echo FFTW_INCLUDE_DIR=$prefix/include >> $GITHUB_ENV
54+
#echo FFTW_LIBRARY_DIR=$prefix/lib >> $GITHUB_ENV
55+
;;
56+
esac
57+
58+
- run: python -m pip install -U pip build
59+
60+
- run: python -m build
61+
62+
- uses: mpi4py/setup-mpi@v1
63+
with:
64+
mpi: ${{ matrix.mpi }}
65+
66+
- run: pip install -vvv dist/mpi4py_fft-*.whl
67+
68+
- run: pip install -r conf/requirements-test.txt
69+
70+
- run: ./runtests.sh
71+
working-directory: tests

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ _templates/
1111
*.dat
1212
*.html
1313
*.xml
14-
*.txt
1514
*.h5
1615
*.nc
1716
*.xdmf

azure-pipelines.yml

+41-34
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
jobs:
2-
- job: macOS
3-
displayName: macos-latest
4-
pool:
5-
vmImage: 'macos-latest'
6-
strategy:
7-
matrix:
8-
Python37:
9-
python.version: '3.7'
10-
Python38:
11-
python.version: '3.8'
12-
Python39:
13-
python.version: '3.9'
14-
Python310:
15-
python.version: '3.10'
16-
17-
steps:
18-
- bash: echo "##vso[task.prependpath]$CONDA/bin"
19-
displayName: Add conda to PATH
20-
21-
- bash: sudo chown -R $USER $CONDA
22-
displayName: Take ownership of conda installation
23-
24-
- bash: |
25-
conda config --add channels conda-forge
26-
conda config --set always_yes yes
27-
conda install -n root conda-build numpy fftw
28-
displayName: Set up Anaconda
29-
30-
- bash: |
31-
conda build --python $PYTHON_VERSION ./conf
32-
displayName: Build and test
2+
# - job: macOS
3+
# displayName: macos-latest
4+
# pool:
5+
# vmImage: 'macos-latest'
6+
# strategy:
7+
# matrix:
8+
# Python37:
9+
# python.version: '3.7'
10+
# Python38:
11+
# python.version: '3.8'
12+
# Python39:
13+
# python.version: '3.9'
14+
# Python310:
15+
# python.version: '3.10'
16+
#
17+
# steps:
18+
# - bash: echo "##vso[task.prependpath]$CONDA/bin"
19+
# displayName: Add conda to PATH
20+
#
21+
# - bash: sudo chown -R $USER $CONDA
22+
# displayName: Take ownership of conda installation
23+
#
24+
# - bash: |
25+
# conda config --add channels conda-forge
26+
# conda config --set always_yes yes
27+
# conda install -n root conda-build numpy fftw
28+
# displayName: Set up Anaconda
29+
#
30+
# - bash: |
31+
# conda build --python $PYTHON_VERSION ./conf
32+
# displayName: Build and test
3333

3434
- job: Ubuntu
3535
displayName: Ubuntu
@@ -45,6 +45,10 @@ jobs:
4545
python.version: '3.9'
4646
Python310:
4747
python.version: '3.10'
48+
Python311:
49+
python.version: '3.11'
50+
Python312:
51+
python.version: '3.12'
4852

4953
steps:
5054
- bash: echo "##vso[task.prependpath]$CONDA/bin"
@@ -53,13 +57,16 @@ jobs:
5357
- bash: |
5458
conda config --add channels conda-forge
5559
conda config --set always_yes yes
56-
conda install -n root conda-build numpy fftw
60+
conda install -n root mpi4py mpich numpy fftw
5761
displayName: Set up Anaconda
5862
5963
- bash: |
60-
conda build --no-test --python $PYTHON_VERSION ./conf
61-
conda create --name mpi4py_fft_env mpi4py_fft_test coverage scipy pyfftw=0.12 python=$PYTHON_VERSION --use-local
64+
conda create --name mpi4py_fft_env \
65+
python=$PYTHON_VERSION \
66+
mpi4py mpich numpy fftw \
67+
pyfftw scipy coverage
6268
source activate mpi4py_fft_env
69+
pip install -vvv --no-deps .
6370
pip install codecov
6471
cd tests && ./runtests.sh
6572
displayName: Build and test

conf/requirements-test.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
coverage
2+
pyfftw; sys_platform == 'linux' and python_version < '3.12'
3+
scipy

tests/runtests.sh

+25-40
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,32 @@
11
#!/bin/sh
22
set -e
33

4-
PY=$(python -c 'import sys; print(sys.version_info.major)')
5-
export OMPI_MCA_plm=isolated
6-
export OMPI_MCA_btl_vader_single_copy_mechanism=none
7-
export OMPI_MCA_rmaps_base_oversubscribe=yes
4+
export OMPI_MCA_plm_ssh_agent=false
5+
export OMPI_MCA_pml=ob1
6+
export OMPI_MCA_btl=tcp,self
7+
export OMPI_MCA_mpi_yield_when_idle=true
8+
export OMPI_MCA_btl_base_warn_component_unused=false
9+
export OMPI_MCA_rmaps_base_oversubscribe=true
10+
export PRTE_MCA_rmaps_default_mapping_policy=:oversubscribe
811

9-
if [ $PY -eq 3 ]; then
10-
# coverage only for python version 3
12+
python -m coverage erase
1113

12-
python -m coverage erase
14+
python -m coverage run -m test_fftw
15+
python -m coverage run -m test_libfft
16+
python -m coverage run -m test_io
17+
python -m coverage run -m test_darray
18+
mpiexec -n 2 python -m coverage run -m test_pencil
1319

14-
python -m coverage run -m test_fftw
15-
python -m coverage run -m test_libfft
16-
python -m coverage run -m test_io
17-
python -m coverage run -m test_darray
18-
mpiexec -n 2 python -m coverage run -m test_pencil
20+
#mpiexec -n 4 python -m coverage test_pencil.py
21+
#mpiexec -n 8 python -m coverage test_pencil.py
22+
mpiexec -n 2 python -m coverage run -m test_mpifft
23+
#mpiexec -n 4 python -m coverage test_mpifft.py
24+
# mpiexec -n 8 python -m coverage test_mpifft.py
25+
# mpiexec -n 12 python -m coverage test_mpifft.py
26+
mpiexec -n 2 python -m coverage run spectral_dns_solver.py
27+
mpiexec -n 2 python -m coverage run -m test_io
28+
#mpiexec -n 4 python -m coverage run -m test_io
29+
mpiexec -n 2 python -m coverage run -m test_darray
30+
#mpiexec -n 4 python -m coverage run -m test_darray
1931

20-
#mpiexec -n 4 python -m coverage test_pencil.py
21-
#mpiexec -n 8 python -m coverage test_pencil.py
22-
mpiexec -n 2 python -m coverage run -m test_mpifft
23-
#mpiexec -n 4 python -m coverage test_mpifft.py
24-
# mpiexec -n 8 python -m coverage test_mpifft.py
25-
# mpiexec -n 12 python -m coverage test_mpifft.py
26-
mpiexec -n 2 python -m coverage run spectral_dns_solver.py
27-
mpiexec -n 2 python -m coverage run -m test_io
28-
#mpiexec -n 4 python -m coverage run -m test_io
29-
mpiexec -n 2 python -m coverage run -m test_darray
30-
#mpiexec -n 4 python -m coverage run -m test_darray
31-
32-
python -m coverage combine
33-
34-
else
35-
python test_fftw.py
36-
python test_libfft.py
37-
mpiexec -n 2 python test_pencil.py
38-
#mpiexec -n 4 python test_pencil.py
39-
#mpiexec -n 8 python test_pencil.py
40-
mpiexec -n 2 python test_mpifft.py
41-
#mpiexec -n 4 python test_mpifft.py
42-
# mpiexec -n 8 python test_mpifft.py
43-
# mpiexec -n 12 python test_mpifft.py
44-
mpiexec -n 2 python test_io.py
45-
mpiexec -n 2 python test_darray.py
46-
mpiexec -n 2 python spectral_dns_solver.py
47-
fi
32+
python -m coverage combine

tests/test_mpifft.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ def test_mpifft():
152152
fft.backward.input_array.shape)
153153
assert (fft.backward.output_pencil.subshape ==
154154
fft.backward.output_array.shape)
155-
assert np.alltrue(np.array(fft.global_shape(True)) == np.array(fft.forward.output_pencil.shape))
156-
assert np.alltrue(np.array(fft.global_shape(False)) == np.array(fft.forward.input_pencil.shape))
155+
assert np.all(np.array(fft.global_shape(True)) == np.array(fft.forward.output_pencil.shape))
156+
assert np.all(np.array(fft.global_shape(False)) == np.array(fft.forward.input_pencil.shape))
157157
ax = -1 if axes is None else axes[-1] if isinstance(axes[-1], int) else axes[-1][-1]
158158
assert fft.forward.input_pencil.substart[ax] == 0
159159
assert fft.backward.output_pencil.substart[ax] == 0

tests/test_speed.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
from time import time
22
import numpy as np
3+
import pyfftw
34
import scipy.fftpack as sp
45
from mpi4py_fft import fftw
56
import pickle
67

7-
try:
8-
import pyfftw
9-
except ImportError:
10-
print('pyFFTW not available')
11-
raise SystemExit(0)
12-
138
try:
149
#fftw.import_wisdom('wisdom.dat')
1510
pyfftw.import_wisdom(pickle.load(open('pyfftw.wisdom', 'rb')))

0 commit comments

Comments
 (0)