Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CI #243

Merged
merged 3 commits into from
Mar 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 49 additions & 29 deletions .github/workflows/test-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ env:
PYTHON_VERSION: "3.10"
BART_VERSION: "0.8.00"
ref_backend: "finufft"
create_venv: "python -m venv $RUNNER_WORKSPACE/venv"
activate_venv: "source $RUNNER_WORKSPACE/venv/bin/activate"
setup_cuda: "export CUDA_BIN_PATH=/usr/local/cuda-12.1/;export PATH=/usr/local/cuda-12.1/bin/:${PATH};export LD_LIBRARY_PATH=/usr/local/cuda-12.1/lib64/:${LD_LIBRARY_PATH}"

jobs:
test-cpu:
Expand Down Expand Up @@ -44,28 +47,38 @@ jobs:
- name: Install Python Deps
shell: bash
run: |
python --version
${{ env.create_venv }}
${{ env.activate_venv }}
python -m pip install --upgrade pip
python -m pip install -e .[test]

- name: Install pynfft
if: ${{ matrix.backend == 'pynfft' || env.ref_backend == 'pynfft' }}
shell: bash
run: |
${{ env.activate_venv }}
python -m pip install "pynfft2>=1.4.3"

- name: Install pynufft
if: ${{ matrix.backend == 'pynufft-cpu' || env.ref_backend == 'pynufft-cpu' }}
run: python -m pip install pynufft
run: |
${{ env.activate_venv }}
python -m pip install pynufft

- name: Install finufft
if: ${{ matrix.backend == 'finufft' || env.ref_backend == 'finufft'}}
shell: bash
run: python -m pip install finufft
run: |
${{ env.activate_venv }}
python -m pip install finufft

- name: Install Sigpy
if: ${{ matrix.backend == 'sigpy' || env.ref_backend == 'sigpy'}}
shell: bash
run: python -m pip install sigpy
run: |
${{ env.activate_venv }}
python -m pip install sigpy

- name: Install BART
if: ${{ matrix.backend == 'bart' || env.ref_backend == 'bart'}}
Expand All @@ -81,14 +94,17 @@ jobs:

- name: Install torchkbnufft-cpu
if: ${{ matrix.backend == 'torchkbnufft-cpu' || env.ref_backend == 'torchkbnufft-cpu'}}
run: python -m pip install torchkbnufft
run: |
${{ env.activate_venv }}
python -m pip install torchkbnufft


- name: Run Tests
shell: bash
run: |
${{ env.activate_venv }}
export COVERAGE_FILE=coverage_${{ matrix.backend }}
pytest -k='operators' --backend ${{ matrix.backend }} --ref ${{ env.ref_backend }} --cov --disable-pytest-warnings --cov-branch --cov-report=term
python -m pytest -k='operators' --backend ${{ matrix.backend }} --ref ${{ env.ref_backend }} --cov --disable-pytest-warnings --cov-branch --cov-report=term
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
Expand All @@ -111,43 +127,39 @@ jobs:
- 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 cupy-cuda12x finufft "numpy<2.0"
${{ env.create_venv }}
${{ env.activate_venv }}
python -m pip install --upgrade pip wheel
python -m pip install -e .[test]
python -m pip install cupy-cuda12x finufft "numpy<2.0"

- name: Install torch with CUDA 12.1
shell: bash
if: ${{ matrix.backend != 'tensorflow'}}
run: |
source $RUNNER_WORKSPACE/venv/bin/activate
pip install torch
${{ env.activate_venv }}
python -m pip install torch

- name: Install backend
shell: bash
run: |
source $RUNNER_WORKSPACE/venv/bin/activate
export CUDA_BIN_PATH=/usr/local/cuda-12.1/
export PATH=/usr/local/cuda-12.1/bin/:${PATH}
export LD_LIBRARY_PATH=/usr/local/cuda-12.1/lib64/:${LD_LIBRARY_PATH}
${{ env.activate_venv }}
${{ env.setup_cuda }}
if [[ ${{ matrix.backend }} == "torchkbnufft-gpu" ]]; then
pip install torchkbnufft
python -m pip install torchkbnufft
elif [[ ${{ matrix.backend }} == "tensorflow" ]]; then
pip install tensorflow-mri==0.21.0 tensorflow-probability==0.17.0 tensorflow-io==0.27.0 matplotlib==3.7
python -m pip install tensorflow-mri==0.21.0 tensorflow-probability==0.17.0 tensorflow-io==0.27.0 matplotlib==3.7
elif [[ ${{ matrix.backend }} == "cufinufft" ]]; then
pip install "cufinufft<2.3"
python -m pip install "cufinufft<2.3"
else
pip install ${{ matrix.backend }}
python -m pip install ${{ matrix.backend }}
fi

- name: Run Tests
shell: bash
run: |
${{ env.activate_venv }}
cd $RUNNER_WORKSPACE/mri-nufft
source $RUNNER_WORKSPACE/venv/bin/activate
export COVERAGE_FILE=coverage_${{ matrix.backend }}
python -m pytest -k='operators' --ref ${{ env.ref_backend }} --backend ${{ matrix.backend }} --disable-pytest-warnings --cov --cov-branch --cov-report=term

Expand Down Expand Up @@ -205,21 +217,23 @@ jobs:
- name: Install Python deps
shell: bash
run: |
${{ env.create_venv }}
${{ env.activate_venv }}
python -m pip install --upgrade pip
python -m pip install -e .[extra,test,dev]
python -m pip install finufft pooch brainweb-dl torch fastmri

- name: Install GPU related interfaces
run: |
export CUDA_BIN_PATH=/usr/local/cuda-12.1/
export PATH=/usr/local/cuda-12.1/bin/:${PATH}
export LD_LIBRARY_PATH=/usr/local/cuda-12.1/lib64/:${LD_LIBRARY_PATH}
${{ env.activate_venv }}
${{ env.setup_cuda }}
pip install cupy-cuda12x torch
python -m pip install gpuNUFFT "cufinufft<2.3" sigpy scikit-image fastmri

- name: Run examples
shell: bash
run: |
${{ env.activate_venv }}
export COVERAGE_FILE=coverage_plots
pytest examples tests -k="not operators" --cov --cov-branch --cov-report=term

Expand Down Expand Up @@ -260,12 +274,15 @@ jobs:
- name: add the coverage tool
shell: bash
run: |
${{ env.create_venv }}
${{ env.activate_venv }}
python -m pip install --upgrade pip
python -m pip install coverage[toml]
python -m pip install -e .

- name: Combine coverage
run: |
${{ env.activate_venv }}
export COVERAGE_FILE=coverage_combined
coverage combine -a coverage_data/*

Expand All @@ -277,6 +294,7 @@ jobs:

- name: Reports
run: |
${{ env.activate_venv }}
export COVERAGE_FILE=coverage_combined
coverage xml
coverage report
Expand Down Expand Up @@ -316,20 +334,22 @@ jobs:
- name: Install dependencies
shell: bash -l {0}
run: |
${{ env.create_venv }}
${{ env.activate_venv }}
python -m pip install --upgrade pip
python -m pip install .[doc]
python -m pip install finufft

- name: Install GPU related interfaces
run: |
export CUDA_BIN_PATH=/usr/local/cuda-12.1/
export PATH=/usr/local/cuda-12.1/bin/:${PATH}
export LD_LIBRARY_PATH=/usr/local/cuda-12.1/lib64/:${LD_LIBRARY_PATH}
${{ env.activate_venv }}
${{ env.setup_cuda }}
pip install cupy-cuda12x torch
python -m pip install gpuNUFFT "cufinufft<2.3"

- name: Build API documentation
run: |
${{ env.activate_venv }}
python -m sphinx docs docs_build

- name: Display data
Expand Down
Loading