# scikit-build-core builds the .so via CMake; the debug sources are not tracked # into debugsourcefiles.list (empty -> FTBFS), so disable the debug package. %global debug_package %{nil} Name: python-babelviscofdtd Version: 1.2.7 Release: 2%{?dist} Summary: GPU/CPU 3D FDTD solution of viscoelastic equation License: BSD-3-Clause URL: https://github.com/ProteusMRIgHIFU/BabelViscoFDTD Source0: https://github.com/ProteusMRIgHIFU/BabelViscoFDTD/archive/main.tar.gz # Upstream appends -march=native, which bakes the builder's ISA into the rpm. Patch0: babelviscofdtd-no-march-native.patch # The extensions install inside the package but are imported from top level. Patch1: babelviscofdtd-relative-extension-import.patch BuildRequires: python3-devel BuildRequires: python3-pip # pyproject.toml uses build-backend = scikit_build_core.build (not setuptools), # which drives cmake via the ninja generator. BuildRequires: python3-scikit-build-core BuildRequires: ninja-build BuildRequires: python3-numpy BuildRequires: python3-scipy BuildRequires: python3-h5py BuildRequires: python3-hdf5plugin BuildRequires: python3-pydicom BuildRequires: python3-pyopencl BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: opencl-headers BuildRequires: ocl-icd-devel # %%check disassembles the extensions to prove no AVX-512 leaked in BuildRequires: binutils %description GPU/CPU 3D FDTD solution of viscoelastic equation. %package -n python3-babelviscofdtd Summary: %{summary} Requires: python3-numpy Requires: python3-scipy Requires: python3-h5py Requires: python3-hdf5plugin Requires: python3-pydicom Requires: python3-pyopencl %description -n python3-babelviscofdtd GPU/CPU 3D FDTD solution of viscoelastic equation. %prep %autosetup -n BabelViscoFDTD-main -p1 %build # setup.py calls cmake. # We ensure cmake and build dependencies are present. %pyproject_wheel %install %pyproject_install %check # Two defects shipped in 1.2.7-1, and the first hid the second. # # 1. The CPU solver -- the only backend this package builds -- could not be # imported at all. StaggeredFDTD_3D_With_Relaxation.py does # `import _FDTDStaggered3D_with_relaxation_double`, an absolute top-level # import, while the extensions install inside BabelViscoFDTD/. The # importing code catches bare `except:` and prints # "StaggeredFDTD_3D_CPU NOT loaded", so the package imported cleanly, # passed every presence check, and had no working solver. _sp=%{buildroot}%{python3_sitearch} # From the source directory, `python3 -c` puts the cwd ahead of PYTHONPATH, # so BabelViscoFDTD resolves to the unbuilt source copy -- which has the .py # files and none of the compiled extensions, and fails with the very error # this check exists to detect. Leave the source tree first. cd / PYTHONPATH="$_sp" %{python3} -c " from BabelViscoFDTD.StaggeredFDTD_3D_With_Relaxation import StaggeredFDTD_3D print('CPU backend imports') " # 2. With the backend loadable it died instantly with SIGILL on a CPU # without AVX-512, because upstream's -march=native let the builder # choose the instruction set. Assert the shipped extensions carry no # AVX-512; %%{optflags} targets the x86_64 baseline and must win. %ifarch x86_64 for _so in $_sp/BabelViscoFDTD/_FDTDStaggered3D_with_relaxation_*.so; do if objdump -d "$_so" | grep -qE '%%zmm[0-9]'; then echo "ERROR: $(basename $_so) contains AVX-512 (%%zmm) -- -march=native leaked in" >&2 exit 1 fi done echo "no AVX-512 in the shipped extensions" %endif %files -n python3-babelviscofdtd %license LICENSE %doc README.md # The scikit-build-core backend nests the compiled _FDTDStaggered*.so # extensions inside the package dir (wheel.packages = ["BabelViscoFDTD"]), so # this dir entry captures them; the old top-level .so glob no longer applies. %{python3_sitearch}/BabelViscoFDTD # The dist-info version drifts because Source0 fetches main.tar.gz (not a tag); # the wheel build uses whatever pyproject.toml says in that snapshot. Glob it. %{python3_sitearch}/babelviscofdtd-*.dist-info %changelog * Mon Oct 05 2026 Morgan Hough - 1.2.7-2 - The CPU solver, which is the only backend this package builds, has never worked. Two defects, and the first concealed the second. - Patch1: StaggeredFDTD_3D_With_Relaxation.py imports the compiled extensions by their bare top-level names, but scikit-build-core installs them inside BabelViscoFDTD/. The import therefore always failed, and PropagationModel.py catches it with a bare `except:` and prints "StaggeredFDTD_3D_CPU NOT loaded" before carrying on. The package imported, every presence and import test passed, and there was no solver. (It also prints "StaggeredFDTD_3D_METAL loaded" on Linux, which is how little those lines mean.) - Patch0: with the backend loadable, a 48x48x160 water propagation died immediately with SIGILL. Upstream's src/CMakeLists.txt appends -march=native whenever STAGGERED_OPT is set; its only guard is for macOS cross-compilation and never fires on Linux. The COPR builder has AVX-512, so the shipped _FDTDStaggered3D_*.so carried %%zmm registers and could not run on an i9-9980HK (AVX2, no AVX-512) -- or on most consumer x86_64. Removed, leaving %%{optflags} to set the baseline. Same defect class as mrtrix3's ARCH=native in 3.0.8-5. - %%autosetup gains -p1, without which both patches would be applied at strip 0, reported as "ignored", and skipped silently. - %%check now imports the CPU backend and disassembles the shipped extensions to fail the build on any %%zmm register. Either check alone would have caught one of these in May. * Sat Jul 18 2026 Morgan Hough - 1.2.7-1 - Update to 1.2.7 * Wed Jun 10 2026 Morgan Hough - 1.2.6-4 - Fix BackendUnavailable FTBFS: pyproject.toml uses build-backend = scikit_build_core.build, but the spec only BuildRequired setuptools/wheel. BuildRequire python3-scikit-build-core (+ ninja-build, its default cmake generator) so %%pyproject_wheel can load the backend. Unblocks BabelBrain (BabelViscoFDTD is its core solver) * Tue May 26 2026 Morgan Hough - 1.2.6-3 - Restore _FDTDStaggered*.so glob in %%files: the wheel actually installs the cython extensions at BOTH top-level sitearch AND inside BabelViscoFDTD/. The -2 removal was wrong. * Tue May 26 2026 Morgan Hough - 1.2.6-2 - Glob the .dist-info path: Source0 fetches main.tar.gz which drifts between pyproject.toml versions, so a literal version in %%files breaks reproducibility. * Tue May 26 2026 Morgan Hough - 1.2.6-1 - Bump to 1.2.6 (upstream pyproject.toml metadata version; the v1.2.3 GitHub tag actually contains 1.2.6 in setup.cfg). - Drop erroneous top-level _FDTDStaggered*.so glob from %%files — the cython extensions are inside BabelViscoFDTD/ (already covered). * Sun Feb 01 2026 Morgan Hough - 1.0.6-1 - Initial package