From c6c3a64171b274ba142b93c2e636b172eb2c671f Mon Sep 17 00:00:00 2001 From: Lisandro Dalcin Date: Tue, 15 Aug 2023 09:57:17 +0300 Subject: [PATCH] GHA: Install with pip --- .github/workflows/main.yml | 61 +++++++++++++++++++++---------- azure-pipelines.yml | 73 ++++++++++++++++++++------------------ tests/test_mpifft.py | 4 +-- tests/test_speed.py | 7 +--- 4 files changed, 85 insertions(+), 60 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e8cc6cf..b68b796 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,34 +1,59 @@ name: github-CI -on: [push] +on: + push: + branches: + - master + pull_request: + branches: + - master + workflow_dispatch: jobs: - build: - + test: runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest] - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] - name: Python ${{ matrix.python-version }} example (${{ matrix.os }}) - - defaults: - run: - shell: bash -el {0} + os: + - ubuntu-latest + - macos-latest + mpi: + - mpich + - openmpi + python-version: + - "3.7" + - "3.8" + - "3.9" + - "3.10" + - "3.11" + - "3.12-dev" steps: - uses: actions/checkout@v3 - - uses: conda-incubator/setup-miniconda@v2 + - uses: actions/setup-python@v4 with: - miniforge-variant: Mambaforge - miniforge-version: latest - channel-priority: strict python-version: ${{ matrix.python-version }} - conda-build-version: '*' - - run: conda install -n root numpy fftw - - run: conda build --python ${{ matrix.python-version }} ./conf - - run: conda install --use-local mpi4py_fft_test + - run: | + # Install fftw + case $(uname) in + Linux) + sudo apt update && sudo apt install -y -q fftw-dev + ;; + Darwin) + brew install fftw + ;; + esac + + - run: python -m pip install -U pip build + + - run: python -m build + + - uses: mpi4py/setup-mpi@v1 + with: + mpi: ${{ matrix.mpi }} + + - run: pip install -vvv dist/mpi4py_fft-*.whl diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4d8c6d2..74a14fa 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,35 +1,35 @@ jobs: -- job: macOS - displayName: macos-latest - pool: - vmImage: 'macos-latest' - strategy: - matrix: - Python37: - python.version: '3.7' - Python38: - python.version: '3.8' - Python39: - python.version: '3.9' - Python310: - python.version: '3.10' - - steps: - - bash: echo "##vso[task.prependpath]$CONDA/bin" - displayName: Add conda to PATH - - - bash: sudo chown -R $USER $CONDA - displayName: Take ownership of conda installation - - - bash: | - conda config --add channels conda-forge - conda config --set always_yes yes - conda install -n root conda-build numpy fftw - displayName: Set up Anaconda - - - bash: | - conda build --python $PYTHON_VERSION ./conf - displayName: Build and test +# - job: macOS +# displayName: macos-latest +# pool: +# vmImage: 'macos-latest' +# strategy: +# matrix: +# Python37: +# python.version: '3.7' +# Python38: +# python.version: '3.8' +# Python39: +# python.version: '3.9' +# Python310: +# python.version: '3.10' +# +# steps: +# - bash: echo "##vso[task.prependpath]$CONDA/bin" +# displayName: Add conda to PATH +# +# - bash: sudo chown -R $USER $CONDA +# displayName: Take ownership of conda installation +# +# - bash: | +# conda config --add channels conda-forge +# conda config --set always_yes yes +# conda install -n root conda-build numpy fftw +# displayName: Set up Anaconda +# +# - bash: | +# conda build --python $PYTHON_VERSION ./conf +# displayName: Build and test - job: Ubuntu displayName: Ubuntu @@ -45,6 +45,8 @@ jobs: python.version: '3.9' Python310: python.version: '3.10' + Python311: + python.version: '3.11' steps: - bash: echo "##vso[task.prependpath]$CONDA/bin" @@ -53,13 +55,16 @@ jobs: - bash: | conda config --add channels conda-forge conda config --set always_yes yes - conda install -n root conda-build numpy fftw + conda install -n root mpi4py mpich numpy fftw displayName: Set up Anaconda - bash: | - conda build --no-test --python $PYTHON_VERSION ./conf - conda create --name mpi4py_fft_env mpi4py_fft_test coverage scipy pyfftw=0.12 python=$PYTHON_VERSION --use-local + conda create --name mpi4py_fft_env \ + python=$PYTHON_VERSION \ + numpy fftw mpi4py mpich \ + pyfftw=0.12 scipy coverage source activate mpi4py_fft_env + pip install -vvv --no-deps . pip install codecov cd tests && ./runtests.sh displayName: Build and test diff --git a/tests/test_mpifft.py b/tests/test_mpifft.py index 2ea851a..5d4ca30 100644 --- a/tests/test_mpifft.py +++ b/tests/test_mpifft.py @@ -152,8 +152,8 @@ def test_mpifft(): fft.backward.input_array.shape) assert (fft.backward.output_pencil.subshape == fft.backward.output_array.shape) - assert np.alltrue(np.array(fft.global_shape(True)) == np.array(fft.forward.output_pencil.shape)) - assert np.alltrue(np.array(fft.global_shape(False)) == np.array(fft.forward.input_pencil.shape)) + assert np.all(np.array(fft.global_shape(True)) == np.array(fft.forward.output_pencil.shape)) + assert np.all(np.array(fft.global_shape(False)) == np.array(fft.forward.input_pencil.shape)) ax = -1 if axes is None else axes[-1] if isinstance(axes[-1], int) else axes[-1][-1] assert fft.forward.input_pencil.substart[ax] == 0 assert fft.backward.output_pencil.substart[ax] == 0 diff --git a/tests/test_speed.py b/tests/test_speed.py index 5d20553..ce70fa0 100644 --- a/tests/test_speed.py +++ b/tests/test_speed.py @@ -1,15 +1,10 @@ from time import time import numpy as np +import pyfftw import scipy.fftpack as sp from mpi4py_fft import fftw import pickle -try: - import pyfftw -except ImportError: - print('pyFFTW not available') - raise SystemExit(0) - try: #fftw.import_wisdom('wisdom.dat') pyfftw.import_wisdom(pickle.load(open('pyfftw.wisdom', 'rb')))