diff --git a/Dockerfile b/Dockerfile index dd4f6c7c2c..b37418ee80 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,20 +3,19 @@ # - https://github.com/TomographicImaging/CIL#installation-of-cil # consumers: # - harbor.stfc.ac.uk/imaging-tomography/cil -FROM jupyter/tensorflow-notebook:ubuntu-22.04 +FROM quay.io/jupyter/tensorflow-notebook:ubuntu-24.04 LABEL org.opencontainers.image.source=https://github.com/TomographicImaging/CIL # tigre: BSD-3-Clause, astra-toolbox: GPL-3.0 LABEL org.opencontainers.image.licenses="Apache-2.0 AND BSD-3-Clause AND GPL-3.0" +# CUDA-specific packages +ARG CIL_EXTRA_PACKAGES="ccpi::tigre=3.1.3 astra-toolbox::astra-toolbox=2.4" # build & runtime dependencies -# TODO: sync scripts/create_local_env_for_cil_development.sh, scripts/cil_development.yml, recipe/meta.yaml (e.g. missing libstdcxx-ng _openmp_mutex pip)? -# vis. https://github.com/TomographicImaging/CIL/pull/1590 +# TODO: sync scripts/cil_development.yml, recipe.yaml COPY --chown="${NB_USER}" scripts/cil_development.yml environment.yml -# channel_priority: https://stackoverflow.com/q/58555389 -RUN 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 astra-toolbox conda-forge; do conda config --env --add channels $ch; done \ - && mamba env update -n base \ +RUN sed -ri '/tigre|astra-toolbox| python /d' environment.yml \ + && for pkg in 'jupyter-server-proxy>4.1.0' $CIL_EXTRA_PACKAGES; do echo " - $pkg" >> environment.yml; done \ + && mamba env update -n base -f environment.yml \ && mamba clean -a -y -f \ && rm environment.yml \ && fix-permissions "${CONDA_DIR}" /home/${NB_USER} @@ -26,5 +25,6 @@ ENV TENSORBOARD_PROXY_URL=/user-redirect/proxy/6006/ # build & install CIL COPY --chown="${NB_USER}" . src +ENV CIL_FORCE_IPP=ON RUN pip install ./src && rm -rf src \ && fix-permissions "${CONDA_DIR}" /home/${NB_USER} diff --git a/Wrappers/Python/test/test_algorithms.py b/Wrappers/Python/test/test_algorithms.py index 61c11824cd..1da91a6e3a 100644 --- a/Wrappers/Python/test/test_algorithms.py +++ b/Wrappers/Python/test/test_algorithms.py @@ -1937,7 +1937,7 @@ def test_initialization_with_params(self): def test_set_up(self): lsqr = LSQR(initial=self.initial, operator=self.Aop, data=self.bop, alpha=0.5) beta = (self.bop -self.Aop.direct(self.initial)).norm() - self.assertAlmostEqual(lsqr.beta, beta, 5 ) + self.assertAlmostEqual(lsqr.beta, beta, 4) self.assertAlmostEqual(lsqr.phibar, beta, 5 ) self.assertAlmostEqual(lsqr.normr, beta, 5 ) alpha = self.Aop.adjoint((self.bop -self.Aop.direct(self.initial))/beta).norm() diff --git a/Wrappers/Python/test/test_wavelets.py b/Wrappers/Python/test/test_wavelets.py index 2bcf3e357e..b1179f07ba 100644 --- a/Wrappers/Python/test/test_wavelets.py +++ b/Wrappers/Python/test/test_wavelets.py @@ -232,7 +232,7 @@ def test_wavelet_adjoint(self): ip1 = c.dot(W.direct(x)) ip2 = x.dot(W.adjoint(c)) M = x.norm() # Normalization - self.assertAlmostEqual(ip1/M, ip2/M, places=5, msg="Periodization convolution should be closest to true adjoint") + self.assertAlmostEqual(ip1/M, ip2/M, 4, msg="Periodization convolution should be closest to true adjoint") def test_WaveletOperator_norm(self): n = 64 @@ -336,4 +336,4 @@ def test_L1Sparsity_complex_input(self): if __name__ == "__main__": - unittest.main() \ No newline at end of file + unittest.main() diff --git a/pyproject.toml b/pyproject.toml index 57b54d8d73..1de85bd169 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,6 +15,8 @@ sdist.include = ["Wrappers/Python/cil/version.py"] sdist.exclude = ["scripts", "docs", "Wrappers/Python/data", "Wrappers/Python/test", ".*"] [tool.scikit-build.wheel.packages] cil = "Wrappers/Python/cil" +[tool.scikit-build.cmake.define] +CIL_FORCE_IPP = {env="CIL_FORCE_IPP", default="OFF"} [tool.setuptools] package-dir = {"" = "Wrappers/Python"} diff --git a/recipe.yaml b/recipe.yaml index 8536e4cc61..7fe9f3ded1 100644 --- a/recipe.yaml +++ b/recipe.yaml @@ -28,6 +28,7 @@ build: env: CMAKE_BUILD_TYPE: Release CMAKE_GENERATOR: Ninja + CIL_FORCE_IPP: ${{ "ON" if x86_64 else "OFF" }} requirements: build: diff --git a/src/Core/CMakeLists.txt b/src/Core/CMakeLists.txt index 11eff34554..1314052712 100644 --- a/src/Core/CMakeLists.txt +++ b/src/Core/CMakeLists.txt @@ -51,7 +51,11 @@ else() endif() list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +option(CIL_FORCE_IPP "Force CIL to use IPP" OFF) find_package(IPP) +if(CIL_FORCE_IPP AND NOT IPP_FOUND) + message(FATAL_ERROR "CIL_FORCE_IPP and NOT IPP_FOUND") +endif() list(APPEND cilacc_SOURCES utilities.cpp axpby.cpp FiniteDifferenceLibrary.cpp) list(APPEND cilacc_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/include)