Benchmark tweaks #455
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
workflow_dispatch: | |
env: | |
PYTHON_VERSION: "3.10" | |
BART_VERSION: "0.8.00" | |
ref_backend: "finufft" | |
jobs: | |
linter-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python ${{ env.PYTHON_VERSION }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: pip | |
cache-dependency-path: pyproject.toml | |
- name: Black setup | |
shell: bash | |
run: pip install black ruff | |
- name: Black Check | |
shell: bash | |
run: black . --diff --color --check | |
- name: ruff Check | |
shell: bash | |
run: ruff src | |
test-cpu: | |
runs-on: ubuntu-latest | |
needs: linter-check | |
strategy: | |
matrix: | |
backend: [finufft, pynfft, pynufft, bart, sigpy] | |
exclude: | |
- backend: bart | |
- backend: pynfft | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: pip | |
cache-dependency-path: pyproject.toml | |
- name: Install Dependencies | |
shell: bash | |
run: | | |
sudo apt install -y libnfft3-dev | |
python --version | |
python -m pip install --upgrade pip | |
python -m pip install -e .[test] | |
- name: Install pynfft | |
if: ${{ matrix.backend == 'pynfft' || env.ref_backend == 'pynfft' }} | |
run: python -m pip install pynfft2 "cython<3.0.0" | |
- name: Install pynufft | |
if: ${{ matrix.backend == 'pynufft' || env.ref_backend == 'pynufft' }} | |
run: python -m pip install pynufft | |
- name: Install finufft | |
if: ${{ matrix.backend == 'finufft' || env.ref_backend == 'finufft'}} | |
shell: bash | |
run: python -m pip install finufft | |
- name: Install Sigpy | |
if: ${{ matrix.backend == 'sigpy' || env.ref_backend == 'sigpy'}} | |
shell: bash | |
run: python -m pip install sigpy | |
- name: Install BART | |
if: ${{ matrix.backend == 'bart' || env.ref_backend == 'bart'}} | |
shell: bash | |
run: | | |
cd $RUNNER_WORKSPACE | |
sudo apt-get install make gcc libfftw3-dev liblapacke-dev libpng-dev libopenblas-dev | |
wget https://github.com/mrirecon/bart/archive/v${{ env.BART_VERSION }}.tar.gz | |
tar xzvf v${{ env.BART_VERSION }}.tar.gz | |
cd bart-${{ env.BART_VERSION }} | |
make | |
echo $PWD >> $GITHUB_PATH | |
- name: Run Tests | |
shell: bash | |
run: | | |
coverage run -m pytest -n auto -v --backend ${{ matrix.backend }} --ref ${{ env.ref_backend }} | |
coverage report | |
- name: Upload coverage | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-cpu-${{ github.sha }} | |
path: .coverage | |
test-gpu: | |
runs-on: GPU | |
needs: linter-check | |
strategy: | |
matrix: | |
backend: [gpunufft, cufinufft] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install mri-nufft and finufft | |
shell: bash | |
run: | | |
cd $RUNNER_WORKSPACE | |
python --version | |
python -m venv venv | |
source $RUNNER_WORKSPACE/venv/bin/activate | |
pip install --upgrade pip wheel | |
pip install -e mri-nufft[test] | |
pip install finufft | |
- name: Install Cufinufft | |
if: ${{ matrix.backend == 'cufinufft' }} | |
shell: bash | |
run: | | |
cd $RUNNER_WORKSPACE | |
rm -rf finufft | |
git clone https://github.com/chaithyagr/finufft --branch chaithyagr/issue306 | |
cd finufft && mkdir build && cd build | |
export PATH=/usr/local/cuda-11.8/bin:$PATH | |
export CUDA_PATH=/usr/local/cuda-11.8 | |
export LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64:$LD_LIBRARY_PATH | |
export CUDA_BIN_PATH=/usr/local/cuda-11.8 | |
cmake -DFINUFFT_USE_CUDA=1 ../ && cmake --build . && cp libcufinufft.so ../python/cufinufft/. | |
# enter venv | |
source $RUNNER_WORKSPACE/venv/bin/activate | |
pip install cupy-cuda11x | |
cd $RUNNER_WORKSPACE/finufft/python/cufinufft | |
python setup.py develop | |
# FIXME: This is hardcoded | |
cp libcufinufft.so cufinufftc.cpython-310-x86_64-linux-gnu.so | |
cd $RUNNER_WORKSPACE | |
- name: Install gpuNUFFT | |
if: ${{ matrix.backend == 'gpunufft' }} | |
shell: bash | |
run: | | |
cd $RUNNER_WORKSPACE | |
rm -rf gpuNUFFT | |
git clone https://github.com/chaithyagr/gpuNUFFT | |
cd gpuNUFFT | |
export PATH=/usr/local/cuda-11.8/bin:$PATH | |
export CUDA_PATH=/usr/local/cuda-11.8 | |
export LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64:$LD_LIBRARY_PATH | |
export CUDA_BIN_PATH=/usr/local/cuda-11.8 | |
source $RUNNER_WORKSPACE/venv/bin/activate | |
python setup.py install | |
- name: Run Tests | |
shell: bash | |
run: | | |
cd $RUNNER_WORKSPACE/mri-nufft | |
source $RUNNER_WORKSPACE/venv/bin/activate | |
python -m coverage run -m pytest -n auto -v --ref ${{ env.ref_backend }} --backend ${{ matrix.backend }} | |
coverage report | |
- name: Upload coverage | |
if: success() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-gpu-${{ github.sha }} | |
path: .coverage | |
- name: Cleanup | |
if: always() | |
shell: bash | |
run: | | |
cd $RUNNER_WORKSPACE | |
ls -al | |
rm -rf finufft | |
rm -rf gpuNUFFT | |
rm -rf venv | |
coverage: | |
runs-on: ubuntu-latest | |
needs: [test-cpu, test-gpu] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Download coverage CPU | |
uses: actions/download-artifact@v3 | |
with: | |
name: coverage-cpu-${{ github.sha }} | |
path: cov-cpu | |
- name: Download coverage GPU | |
uses: actions/download-artifact@v3 | |
with: | |
name: coverage-gpu-${{ github.sha }} | |
path: cov-gpu | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: add the coverage tool | |
shell: bash | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install coverage[toml] | |
python -m pip install -e . | |
- name: Combine coverage | |
shell: bash | |
run: | | |
coverage combine cov-cpu/.coverage cov-gpu/.coverage | |
coverage xml -i | |
coverage report | |
ls -al | |
- name: Upload Join | |
if: success() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-full-${{ github.sha}} | |
path: .coverage |