Skip to content

[Tigre] Initial recipe for libtigre (v3.1.3) - #15370

Open
hashimoto-koh wants to merge 4 commits into
JuliaPackaging:masterfrom
hashimoto-koh:tigre-v2.7.0
Open

hashimoto-koh wants to merge 4 commits into
JuliaPackaging:masterfrom
hashimoto-koh:tigre-v2.7.0

Conversation

@hashimoto-koh

@hashimoto-koh hashimoto-koh commented Oct 30, 2026 •

Copy link
Copy Markdown

This PR adds the initial recipe for Tigre_jll, building libtigre.so for Tigre.jl.

  • Upstream: CERN/TIGRE https://github.com/CERN/TIGRE (v3.1.3, commit 9aad4fe623e8e0dbc5fed32958973e1173185ea0, tag v3.1.3)
  • License: BSD 3-Clause (Upstream TIGRE + Tigre.jl wrapper)
  • Target: Linux x86_64 glibc with CUDA 12.x (libcudart.so.12) via CUDA.supported_platforms(; min_version = v"12.0")
  • Architectures: SASS for sm_70, sm_75, sm_80, sm_86, sm_89, sm_90 + PTX compute_86
  • Products: libtigre.so (pure C ABI bridge exporting tigre_julia_* functions with zero Python/MATLAB/libjulia runtime dependencies)
  • Patches: 0001-fix-piccs-leak-and-device-reset.patch carrying upstream-merged bugfixes (CERN/TIGRE PR [ZeroMQ] without debugging information #800: PICCS GPU memory leak fix and avoidance of cudaDeviceReset).

All 12 tomographic reconstruction algorithms (FDK, FBP, SART, FISTA, LSMR, PICCS, MLEM, PCSD, AwPCSD, TV) have been numerically verified with 120 regression checks on an NVIDIA GeForce RTX 3090 GPU:
https://github.com/hashimoto-koh/Builder4Tigre

@lgoettgens lgoettgens left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some comments inline. Furthermore, the name kind of confuses me, as a _julia in the name usually hints that the package links against libjulia_jll, but this one doesn't

Comment thread T/Tigre/build_tarballs.jl Outdated
sources = [
GitSource(
"https://github.com/CERN/TIGRE.git",
"81b6be2cc12ee630d36cba941e111ba14ba34c7c",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add the tag kwarg

Comment thread T/Tigre/build_tarballs.jl
Comment on lines +7 to +12
# Support platforms and helpers from Yggdrasil
if isfile(joinpath(@__DIR__, "../../platforms/cuda.jl"))
include("../../platforms/cuda.jl")
else
include(joinpath(@__DIR__, "platforms/cuda.jl"))
end

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Support platforms and helpers from Yggdrasil
if isfile(joinpath(@__DIR__, "../../platforms/cuda.jl"))
include("../../platforms/cuda.jl")
else
include(joinpath(@__DIR__, "platforms/cuda.jl"))
end
include("../../platforms/cuda.jl")

Comment thread T/Tigre/build_tarballs.jl Outdated
Comment on lines +33 to +39
if [ -d "TIGRE" ]; then
TIGRE_DIR="TIGRE"
elif [ -d "Common/CUDA" ]; then
TIGRE_DIR="."
else
TIGRE_DIR=$(find . -maxdepth 2 -iname "tigre*" -type d | head -n 1)
fi

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should not be needed. the location is deterministic

Comment thread T/Tigre/build_tarballs.jl Outdated
Comment on lines +80 to +86
if [ -d "${prefix}/cuda" ]; then
CUDA_HOME="${prefix}/cuda"
elif [ -d "${WORKSPACE}/destdir/cuda" ]; then
CUDA_HOME="${WORKSPACE}/destdir/cuda"
else
CUDA_HOME="/usr/local/cuda"
fi

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should not be needed. everything is deterministic

Comment thread T/Tigre/build_tarballs.jl Outdated
Comment on lines +142 to +144
if [ -f "LICENSE" ]; then
install_license "LICENSE"
fi

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if [ -f "LICENSE" ]; then
install_license "LICENSE"
fi
install_license "LICENSE"

if such a file exists, the build should fail loudly if it suddenly is not there

Comment thread T/Tigre/build_tarballs.jl Outdated

# Base platform: Linux x86_64 glibc
base_platforms = [
Platform("x86_64", "linux"; libc = "glibc"),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why only this single platform? Usually, you want to start with supported_platforms() and then filter out anything that doesn't work

Comment thread T/Tigre/build_tarballs.jl Outdated
plat = deepcopy(p)
plat["cuda"] = "12.4"
push!(cuda_platforms, plat)
end

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe there is something pre-built for this, but I am not too familiar with cuda

Comment thread T/Tigre/build_tarballs.jl Outdated
end

# Non-platform arguments passed to build_tarballs
non_platform_ARGS = filter(arg -> startswith(arg, "--"), ARGS)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this for?

…UDA.supported_platforms, and rename library to libtigre
@hashimoto-koh hashimoto-koh changed the title [Tigre] Initial recipe for libtigre_julia (v2.7.0) [Tigre] Initial recipe for libtigre (v3.1.3) Nov 2, 2026
@hashimoto-koh

Copy link
Copy Markdown
Author

Thank you very much for the thorough review and helpful guidance, @lgoettgens!
We have addressed all review comments in commit dfb0fd5:

  1. Library naming (_julia suffix):

    • As you noted, the _julia suffix was confusing since the library does not embed or link against libjulia_jll.
    • We have renamed the library product to libtigre.so (LibraryProduct("libtigre", :libtigre)). The Julia package Tigre.jl is being updated to load libtigre from Tigre_jll.
  2. Upstream versioning and tag kwarg:

    • Pinned version to v"3.1.3" (matching the official upstream release) and added tag = "v$(version)" to GitSource pointing to commit 9aad4fe623e8e0dbc5fed32958973e1173185ea0.
    • The upstream bugfixes (CERN/TIGRE PR [ZeroMQ] without debugging information #800: PICCS GPU memory leak fix, cudaDeviceReset removal, and ray-missing-volume hanging guard) have been extracted into bundled/patches/0001-fix-piccs-leak-and-device-reset.patch.
  3. Deterministic paths and error handling:

    • Switched to deterministic source location ${WORKSPACE}/srcdir/TIGRE and CUDA_HOME="${prefix}/cuda".
    • Removed existence guards on install_license so that missing license files fail loudly.
    • Included fancy_toys.jl and platforms/cuda.jl directly via const YGGDRASIL_DIR = "../..".
  4. Platforms and argument handling:

    • Replaced manual platform looping with platforms = CUDA.supported_platforms(; min_version = v"12.0"), filtered to x86_64 (with a comment documenting that TIGRE directly invokes nvcc without an aarch64 cross-nvcc toolchain).
    • Added lazy_artifacts = true.
    • Adopted the standard should_build_platform(triplet(platform)) || continue pattern and removed non_platform_ARGS, passing ARGS directly to build_tarballs.

All 12 reconstruction algorithms and 120 regression checks were re-verified on an NVIDIA GeForce RTX 3090 with the newly built libtigre.so.

@hashimoto-koh

Copy link
Copy Markdown
Author

Fixed the Buildkite CI failure in commit d748369:

  • Upstream CERN/TIGRE has mixed line endings (CRLF in GD_TV.cu, Siddon_projection.cu, etc., vs LF in PICCS.cu), which caused GNU atomic_patch in the RootFS to reject the patch with Hunk #1 FAILED (different line endings).
  • Added find Common/CUDA -type f -exec dos2unix {} + before atomic_patch and converted bundled/patches/0001-fix-piccs-leak-and-device-reset.patch to pure LF.
  • Re-tested locally on NVIDIA GeForce RTX 3090 with all 12 reconstruction algorithms and 120 regression checks passing.

@hashimoto-koh

Copy link
Copy Markdown
Author

Fixed the CUDA 13.x build failures in commit 994cd20:

  • CUDA 13 dropped support for the Volta architecture (compute_70 / sm_70), causing nvcc to fail with nvcc fatal: Unsupported gpu architecture 'compute_70'.
  • Updated ARCH_FLAGS in build_tarballs.jl to dynamically include sm_70 only for CUDA < 13, while targeting sm_75 through sm_90 (+ PTX compute_86) across all versions.
  • (All CUDA 12.0–12.9 builds already passed cleanly in Build #34609; local hardware verification on RTX 3090 confirmed 120/120 regression tests passing).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants