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
132 changes: 132 additions & 0 deletions conda-recipe/environment/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: httomo
channels:
- astra-toolbox
- conda-forge
dependencies:
- _libgcc_mutex=0.1=conda_forge
- _openmp_mutex=4.5=2_gnu
- aom=3.9.1=hac33072_0
- astra-toolbox=2.4.1=py312hf5d4436_0
- blosc=1.21.6=he440d0b_1
- brunsli=0.1=hd1e3526_2
- bzip2=1.0.8=hda65f42_8
- c-ares=1.34.6=hb03c661_0
- c-blosc2=2.22.0=hc31b594_1
- ca-certificates=2026.1.4=hbd8a1cb_0
- cached-property=1.5.2=hd8ed1ab_1
- cached_property=1.5.2=pyha770c72_1
- charls=2.4.2=h59595ed_0
- cuda-cccl_linux-64=12.9.27=ha770c72_0
- cuda-cudart=12.9.79=h5888daf_0
- cuda-cudart-dev_linux-64=12.9.79=h3f2d84a_0
- cuda-cudart-static_linux-64=12.9.79=h3f2d84a_0
- cuda-cudart_linux-64=12.9.79=h3f2d84a_0
- cuda-nvrtc=12.9.86=hecca717_1
- cuda-version=12.9=h4f385c5_3
- cupy=13.6.0=py312h0317cef_2
- cupy-core=13.6.0=py312h16a6543_2
- dav1d=1.2.1=hd590300_0
- fastrlock=0.8.3=py312h8285ef7_2
- fftw=3.3.10=nompi_h3b011a4_111
- giflib=5.2.2=hd590300_0
- h5py=3.11.0=mpi_openmpi_py312h7cdcccc_1
- hdf5=1.14.3=mpi_openmpi_hf5a2fd3_4
- icu=78.1=h33c6efd_0
- imagecodecs=2026.1.1=py312ha4965bc_0
- imageio=2.37.0=pyhfb79c49_0
- importlib-metadata=8.7.0=pyhe01879c_1
- jxrlib=1.1=hd590300_3
- keyutils=1.6.3=hb9d3cd8_0
- krb5=1.21.3=h659f571_0
- lazy-loader=0.4=pyhd8ed1ab_2
- lcms2=2.17=h717163a_0
- ld_impl_linux-64=2.45=default_hbd61a6d_105
- lerc=4.0.0=h0aef613_1
- libaec=1.1.4=h3f801dc_0
- libastra=2.4.1=cuda_12_0
- libavif16=1.3.0=h6395336_2
- libblas=3.11.0=5_h4a7cf45_openblas
- libbrotlicommon=1.2.0=hb03c661_1
- libbrotlidec=1.2.0=hb03c661_1
- libbrotlienc=1.2.0=hb03c661_1
- libcblas=3.11.0=5_h0358290_openblas
- libcublas=12.9.1.4=h676940d_1
- libcufft=11.4.1.4=hecca717_1
- libcurand=10.3.10.19=h676940d_1
- libcurl=8.18.0=h4e3cde8_0
- libcusolver=11.7.5.82=h676940d_2
- libcusparse=12.5.10.65=hecca717_2
- libdeflate=1.25=h17f619e_0
- libedit=3.1.20250104=pl5321h7949ede_0
- libev=4.33=hd590300_2
- libexpat=2.7.3=hecca717_0
- libffi=3.5.2=h9ec8514_0
- libfreetype=2.14.1=ha770c72_0
- libfreetype6=2.14.1=h73754d4_0
- libgcc=15.2.0=he0feb66_16
- libgcc-ng=15.2.0=h69a702a_16
- libgfortran=15.2.0=h69a702a_16
- libgfortran-ng=15.2.0=h69a702a_16
- libgfortran5=15.2.0=h68bc16d_16
- libgomp=15.2.0=he0feb66_16
- libhwy=1.3.0=h4c17acf_1
- libjpeg-turbo=3.1.2=hb03c661_0
- libjxl=0.11.1=hf08fa70_5
- liblapack=3.11.0=5_h47877c9_openblas
- liblzma=5.8.1=hb9d3cd8_2
- libnghttp2=1.67.0=had1ee68_0
- libnpp=12.4.1.87=h676940d_1
- libnsl=2.0.1=hb9d3cd8_1
- libnvjitlink=12.9.86=hecca717_2
- libopenblas=0.3.30=pthreads_h94d23a6_4
- libpng=1.6.53=h421ea60_0
- libsqlite=3.51.1=hf4e2dac_1
- libssh2=1.11.1=hcf80075_0
- libstdcxx=15.2.0=h934c35e_16
- libstdcxx-ng=15.2.0=hdf11a46_16
- libtiff=4.7.1=h9d88235_1
- libtomo=1.15.3=cuda12.9h1234567_101
- libuuid=2.41.3=h5347b49_0
- libwebp-base=1.6.0=hd42ef1d_0
- libxcb=1.17.0=h8a09558_0
- libxcrypt=4.4.36=hd590300_1
- libzlib=1.3.1=hb9d3cd8_2
- libzopfli=1.0.3=h9c3ff4c_0
- lz4-c=1.10.0=h5888daf_1
- mpi=1.0=openmpi
- mpi4py=4.1.1=py312hd140a38_102
- ncurses=6.5=h2d0b736_3
- networkx=3.6.1=pyhcf101f3_0
- nomkl=1.0=h5ca1d4c_0
- numexpr=2.14.1=py312h88efc94_101
- numpy=2.3.5=py312h33ff503_1
- openjpeg=2.5.4=h55fea9a_0
- openjph=0.26.0=h8d634f6_0
- openmpi=4.1.6=hc5af2df_101
- openssl=3.6.0=h26f9b46_0
- packaging=25.0=pyh29332c3_1
- pillow=12.1.0=py312h50c33e8_0
- pip=25.3=pyh8b19718_0
- pthread-stubs=0.4=hb9d3cd8_1002
- python=3.12.12=hd63d673_1_cpython
- python_abi=3.12=8_cp312
- pywavelets=1.9.0=py312h4f23490_2
- rav1e=0.7.1=h8fae777_3
- readline=8.3=h853b02a_0
- scikit-image=0.25.2=py312hf79963d_2
- scipy=1.16.3=py312h54fa4ab_2
- setuptools=80.9.0=pyhff2d567_0
- snappy=1.2.2=h03e3b7b_1
- svt-av1=3.1.2=hecca717_0
- tifffile=2025.1.10=pyhd8ed1ab_0
- tk=8.6.13=noxft_ha0e22de_103
- tomopy=1.15.3=pyhd8ed1ab_1
- tzdata=2025c=hc9c84f9_1
- wheel=0.45.1=pyhd8ed1ab_1
- xorg-libxau=1.0.12=hb03c661_1
- xorg-libxdmcp=1.1.5=hb03c661_1
- zfp=1.0.1=h909a3a2_5
- zipp=3.23.0=pyhcf101f3_1
- zlib=1.3.1=hb9d3cd8_2
- zlib-ng=2.3.2=hceb46e0_1
- zstd=1.5.7=hb78ec9c_6
2 changes: 1 addition & 1 deletion httomo/base_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,4 @@ def is_gpu(self) -> bool:

@property
def is_cpu(self) -> bool:
return getattr(self._data, "device", None) is None
return self._data.device == "cpu"
4 changes: 2 additions & 2 deletions httomo/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def calculate_stats(
"""

# do this whereever the data is at the moment (GPU/CPU)
if getattr(data, "device", None) is not None:
if data.device != "cpu":
# GPU
data = xp.nan_to_num(data, copy=False, nan=0.0, posinf=0, neginf=0)
else:
Expand Down Expand Up @@ -181,7 +181,7 @@ def _save_dataset_data(
):
start = np.array(global_index)
stop = start + np.array(data.shape)
assert getattr(data, "device", None) is None, "data must be on CPU for saving"
assert data.device == "cpu", "data must be on CPU for saving"
assert stop[0] <= dataset.shape[0]
assert stop[1] <= dataset.shape[1]
assert stop[2] <= dataset.shape[2]
Expand Down
2 changes: 1 addition & 1 deletion httomo/runner/auxiliary_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def set_flats(self, flats: generic_array) -> None:
self._flats = flats

def set_angles(self, angles: np.ndarray) -> None:
assert getattr(angles, "device", None) is None, "Angles must be a CPU array"
assert angles.device == "cpu", "Angles must be a CPU array"
self._angles = angles

def _get_field(self, field: str, gpu=False) -> generic_array:
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ requires-python = ">=3.10"
dynamic = ["version"]
dependencies = [
"click",
"cupy",
"numpy",
"cupy==13.6.*",
"numpy==2.3.*",
"hdf5plugin",
"httomo-backends",
"loguru",
Expand Down
2 changes: 1 addition & 1 deletion tests/method_wrappers/test_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def save_to_images(data, out_dir, comm_rank, axis, file_format):
def test_images_leaves_gpudata(mocker: MockerFixture, dummy_block: DataSetBlock):
class FakeModule:
def save_to_images(data, out_dir, offset):
assert getattr(data, "device", None) is None # make sure it's on CPU
assert data.device == "cpu" # make sure it's on CPU

mocker.patch(
"httomo.method_wrappers.generic.import_module", return_value=FakeModule
Expand Down
2 changes: 1 addition & 1 deletion tests/method_wrappers/test_save_intermediate.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def save_intermediate_data(
angles: np.ndarray,
):
assert isinstance(data, np.ndarray)
assert getattr(data, "device", None) is None
assert data.device == "cpu"

mocker.patch(
"httomo.method_wrappers.generic.import_module", return_value=FakeModule
Expand Down
4 changes: 2 additions & 2 deletions tests/method_wrappers/test_stats_calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ class FakeModule:
def calculate_stats(data, comm):
# regardless of dataset input, we want device data if gpu enabled
if gpu_enabled:
assert getattr(data, "device", None) is not None
assert data.device != "cpu"
else:
assert getattr(data, "device", None) is None
assert data.device == "cpu"
return (1.2, 3.1, 42.0, 10)

mocker.patch(
Expand Down
4 changes: 2 additions & 2 deletions tests/test_base_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def test_to_cpu_transfers_the_data_back():

assert block.is_gpu is False
assert block.is_cpu is True
assert getattr(block.data, "device", None) is None
assert block.data.device == "cpu"


def test_transfer_to_cpu_with_no_gpu(mocker: MockerFixture):
Expand All @@ -270,7 +270,7 @@ def test_transfer_to_cpu_with_no_gpu(mocker: MockerFixture):

assert block.is_gpu is False
assert block.is_cpu is True
assert getattr(block.data, "device", None) is None
assert block.data.device == "cpu"


def test_to_cpu_twice_has_no_effect():
Expand Down
Loading