Skip to content
Draft
Show file tree
Hide file tree
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
42 changes: 31 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,15 @@ jobs:
steps:
- uses: actions/checkout@v4
with: {fetch-depth: 0, submodules: recursive}
- name: Set up uv
uses: astral-sh/setup-uv@v5
with:
version: "0.6.9"
- id: reqs
name: set requirements
run: |
envname="${GITHUB_REPOSITORY##*/}-${GITHUB_RUN_ID}.${GITHUB_RUN_NUMBER}"
echo "envname=$envname" >> $GITHUB_OUTPUT
sed -ri -e 's/^(name: ).*/\1$envname/' -e '/ python /d' -e 's/(.* numpy) .*/\1=${{ matrix.numpy-version }}/' scripts/requirements-test.yml
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -48,12 +51,13 @@ jobs:
name: build
run: |
conda activate "${{ steps.reqs.outputs.envname }}"
UV_PROJECT_ENVIRONMENT=$CONDA_PREFIX uv sync --dev --inexact --all-extras
cmake -S . -B ./build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCONDA_BUILD=ON -DCMAKE_INSTALL_PREFIX="$CONDA_PREFIX"
cmake --build ./build --target install
- name: test
run: |
conda activate "${{ steps.reqs.outputs.envname }}"
TESTS_FORCE_GPU=1 python -m unittest discover -v -k tigre -k TIGRE -k astra -k ASTRA -k gpu -k GPU ./Wrappers/Python/test
TESTS_FORCE_GPU=1 UV_PROJECT_ENVIRONMENT=$CONDA_PREFIX uv run --no-sync python -m unittest discover -v -k tigre -k TIGRE -k astra -k ASTRA -k gpu -k GPU ./Wrappers/Python/test
- if: always()
name: Post Run conda-incubator/setup-miniconda@v3
shell: bash
Expand All @@ -74,6 +78,11 @@ jobs:
steps:
- uses: actions/checkout@v4
with: {fetch-depth: 0, submodules: recursive}
- name: Set up uv
uses: astral-sh/setup-uv@v5
with:
version: "0.6.9"
enable-cache: true
- name: set requirements
run: sed -ri -e '/ python /d' -e 's/(.* numpy) .*/\1=${{ matrix.numpy-version }}/' -e 's/=cuda*//' -e '/tigre/d' scripts/requirements-test.yml
- uses: conda-incubator/setup-miniconda@v3
Expand All @@ -83,10 +92,11 @@ jobs:
activate-environment: cil_dev
- name: build
run: |
UV_PROJECT_ENVIRONMENT=$CONDA_PREFIX uv sync --dev --inexact
cmake -S . -B ./build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCONDA_BUILD=ON -DCMAKE_INSTALL_PREFIX="$CONDA_PREFIX"
cmake --build ./build --target install
- name: test
run: python -m unittest discover -v ./Wrappers/Python/test
run: UV_PROJECT_ENVIRONMENT=$CONDA_PREFIX uv run --no-sync python -m unittest discover -v ./Wrappers/Python/test
conda-matrix:
runs-on: ubuntu-22.04
outputs:
Expand Down Expand Up @@ -175,22 +185,32 @@ jobs:
fetch-depth: 0
submodules: recursive
ref: ${{ github.event.pull_request.head.sha || github.ref }} # fix SHA
- uses: conda-incubator/setup-miniconda@v3
with: {python-version: 3.11}
- name: Set up uv
uses: astral-sh/setup-uv@v5
with:
version: "0.6.9"
enable-cache: true
- name: set requirements
working-directory: .
run: sed -ri -e '/ python /d' -e 's/(.* numpy) .*/\1=${{ matrix.numpy-version }}/' -e 's/=cuda*//' -e '/tigre/d' scripts/requirements-test.yml
- name: Set conda environment
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
environment-file: scripts/requirements-test.yml
activate-environment: cil_dev
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
cache-version: 0
- name: install dependencies
run: |
conda install -c conda-forge -yq conda-merge
conda-merge ../scripts/requirements-test.yml docs_environment.yml > environment.yml
conda env update -n test
conda list
conda install -c conda-forge -yq pandoc
- name: build cil
working-directory: .
run: |
UV_PROJECT_ENVIRONMENT=$CONDA_PREFIX uv sync --dev --group docs --inexact
cmake -S . -B ./build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCONDA_BUILD=ON -DCMAKE_INSTALL_PREFIX="$CONDA_PREFIX"
cmake --build ./build --target install
- name: checkout docs
Expand All @@ -208,7 +228,7 @@ jobs:
docs_dir="${{ github.ref_name }}"
docs_dir="${docs_dir//\//_}"
if test "$docs_dir" = master; then docs_dir=nightly; fi
make BUILDSUBDIR="$docs_dir" dirhtml
UV_PROJECT_ENVIRONMENT=$CONDA_PREFIX uv run --dev --group docs --no-sync make BUILDSUBDIR="$docs_dir" dirhtml
- uses: actions/upload-artifact@v4
with:
name: DocumentationHTML
Expand Down Expand Up @@ -263,7 +283,7 @@ jobs:
- name: test
run: >
docker run --rm -v .:/CIL tomographicimaging/cil:test /bin/bash -c
'python -m unittest discover -v /CIL/Wrappers/Python/test'
'uv run --dev --inexact python -m unittest discover -v /CIL/Wrappers/Python/test'
- uses: docker/build-push-action@v6
with:
cache-from: type=gha
Expand Down
95 changes: 95 additions & 0 deletions .github/workflows/build_uv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: build_uv
on:
release:
types: [published]
push:
branches: [master]
tags: ['**']
paths-ignore:
- 'CHANGELOG.md'
- 'CITATION.cff'
- 'LICENSE'
- 'scripts/**'
- 'NOTICE.txt'
- 'README.md'
pull_request:
branches: [master]
paths-ignore:
- 'CHANGELOG.md'
- 'CITATION.cff'
- 'LICENSE'
- 'scripts/**'
- 'NOTICE.txt'
- 'README.md'
jobs:
uv-test-cuda:
defaults: {run: {shell: 'bash -el {0}'}}
runs-on: [self-hosted, python, cuda]
strategy:
matrix:
python-version: [3.11]
numpy-version: [1.25]
steps:
- uses: actions/checkout@v4
with: {fetch-depth: 0, submodules: recursive}
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: "0.6.5"
- id: reqs
name: set requirements
run: |
envname="${GITHUB_REPOSITORY##*/}-${GITHUB_RUN_ID}.${GITHUB_RUN_NUMBER}"
echo "envname=$envname" >> $GITHUB_OUTPUT
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
environment-file: scripts/requirements-cuda.yml
activate-environment: ${{ steps.reqs.outputs.envname }}
run-post: false
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: "Install Project"
run: |
conda activate "${{ steps.reqs.outputs.envname }}"
conda install conda-forge::cudatoolkit-dev=11.7.0
uv sync --dev --all-extras
- name: test
run: CIL_DATA_DIR=./Wrappers/Python/data uv run --dev python -m unittest discover -v -k tigre -k TIGRE -k astra -k ASTRA -k gpu -k GPU ./Wrappers/Python/test
- if: always()
name: Post Run conda-incubator/setup-miniconda@v3
shell: bash
run: |
sed -i '/${{ steps.reqs.outputs.envname }}/d' ~/.profile
source ~/.profile
conda env remove -n "${{ steps.reqs.outputs.envname }}"
uv-test:
defaults: {run: {shell: 'bash -el {0}'}}
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- python-version: '3.10'
- python-version: 3.12
steps:
- uses: actions/checkout@v4
with: {fetch-depth: 0, submodules: recursive}
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: "0.6.5"
enable-cache: true
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: "Install Project"
run: uv sync --dev
- name: test
run: CIL_DATA_DIR=./Wrappers/Python/data uv run --dev python -m unittest discover -v ./Wrappers/Python/test
pass:
needs: [uv-test-cuda, uv-test]
runs-on: ubuntu-22.04
steps: [{run: echo success}]
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ __pycache__/
/build*
*.vscode*
*.egg*
.ropeproject/
20 changes: 12 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,21 @@ else()
cmake_minimum_required(VERSION 3.4)
endif()

project(cil LANGUAGES CXX)
project(${SKBUILD_PROJECT_NAME} LANGUAGES CXX)

if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.27)

if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.27)
cmake_policy(SET CMP0148 OLD)
endif()

# If APPLE don't use @rpath
if (APPLE)
option(SHARED_LIBS_ABS_PATH "Force shared libraries to be installed with absolute paths (as opposed to rpaths)" ON)
mark_as_advanced( SHARED_LIBS_ABS_PATH )
if (SHARED_LIBS_ABS_PATH)
if(APPLE)
option(
SHARED_LIBS_ABS_PATH
"Force shared libraries to be installed with absolute paths (as opposed to rpaths)"
ON)
mark_as_advanced(SHARED_LIBS_ABS_PATH)
if(SHARED_LIBS_ABS_PATH)
# Set install_name_dir as the absolute path to install_prefix/lib
GET_FILENAME_COMPONENT(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib REALPATH)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
Expand All @@ -44,5 +48,5 @@ if(NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
endif()

add_subdirectory(src/Core)
add_subdirectory(Wrappers/Python)
add_subdirectory(src/cilacc)
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ ARG CIL_EXTRA_PACKAGES="tigre=2.6 astra-toolbox=2.1.0=cuda*"
COPY --chown="${NB_USER}" scripts/requirements-test.yml environment.yml
# channel_priority: https://stackoverflow.com/q/58555389
RUN sed -ri '/tigre|astra-toolbox| python /d' environment.yml \
&& curl -LsSf https://astral.sh/uv/0.6.9/install.sh | sh \
&& for pkg in 'jupyter-server-proxy>4.1.0' $CIL_EXTRA_PACKAGES; do echo " - $pkg" >> environment.yml; done \
&& conda config --env --set channel_priority strict \
&& for ch in defaults nvidia ccpi https://software.repos.intel.com/python/conda conda-forge; do conda config --env --add channels $ch; done \
&& mamba env update -n base \
&& mamba clean -a -y -f \
&& rm environment.yml \
&& fix-permissions "${CONDA_DIR}" /home/${NB_USER}
&& fix-permissions "${CONDA_DIR}" /home/${NB_USER} \
&& UV_PROJECT_ENVIRONMENT=$CONDA_DIR uv sync --all-extras --dev --inexact

# NB: trailing `/` is required
ENV TENSORBOARD_PROXY_URL=/user-redirect/proxy/6006/
Expand Down
30 changes: 0 additions & 30 deletions Wrappers/Python/CMakeLists.txt

This file was deleted.

1 change: 0 additions & 1 deletion Wrappers/Python/cil/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@
#
# Authors:
# CIL Developers, listed at: https://github.com/TomographicImaging/CIL/blob/master/NOTICE.txt

from .version import version as __version__
2 changes: 1 addition & 1 deletion Wrappers/Python/cil/framework/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# Authors:
# CIL Developers, listed at: https://github.com/TomographicImaging/CIL/blob/master/NOTICE.txt

from .cilacc import cilacc
from cil import cilacc
from .acquisition_data import AcquisitionData
from .acquisition_geometry import AcquisitionGeometry, SystemConfiguration
from .data_container import DataContainer
Expand Down
33 changes: 0 additions & 33 deletions Wrappers/Python/cil/framework/cilacc.py

This file was deleted.

Loading
Loading