From b0e17afd0332f916c54b1045ec9573169e7c3523 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Thu, 21 Aug 2025 22:19:52 -0700 Subject: [PATCH 01/12] Relax `libcufile` dependency for old CTK 12 on ARM The CUDA Toolkit (CTK) added cuFile for ARM in CTK 12.2. As a result always requiring `libcufile` with `libcucim` can make it uninstallable on ARM with CTK 12.0 & 12.1. To fix this, build two variants of the `libcucim` package. One with `libcufile` and one without. Constrain `cuda-version` accordingly so that `libcufile` is installed whenever possible. Only when `libcufile` cannot be installed, fallback to the `libcucim` package where the `libcufile` dependency is left off. The `x86_64` CTK has had cuFile since the CTK 11.4. As RAPIDS now requires CUDA 12.0+, there is no issue always requiring `libcufile` on `x86_64`. This issue will not be present in CUDA 13+. So always require `libcufile` in that case. --- ci/build_cpp.sh | 21 ++++++++++++++++++++- conda/recipes/libcucim/meta.yaml | 14 +++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/ci/build_cpp.sh b/ci/build_cpp.sh index ec220e49d..981d2cbb4 100755 --- a/ci/build_cpp.sh +++ b/ci/build_cpp.sh @@ -21,6 +21,25 @@ conda config --set path_conflict warn sccache --zero-stats -RAPIDS_PACKAGE_VERSION=$(rapids-generate-version) rapids-conda-retry build conda/recipes/libcucim + +# TODO: Remove when CUDA 12.1 is dropped. +# In most cases, the CTK has cuFile. +# However the CTK only added cuFile for ARM in 12.2. +# So for users installing with CTK 12.0 & 12.1, relax the cuFile requirement. +# On x86 or CTK 13, always require cuFile. +cat > extra_variants.yaml <> extra_variants.yaml <=3.1.0 - openslide run: + {% if aarch64 and cuda_major == "12" %} + # Relax `libcufile` dependency for old CUDA 12 ARM installs + - {{ pin_compatible('cuda-version', lower_bound='12.0', upper_bound='12.2') }} # [not has_cufile] + - {{ pin_compatible('cuda-version', lower_bound='12.2', upper_bound='13.0') }} # [has_cufile] + - libcufile # [has_cufile] + {% else %} - {{ pin_compatible('cuda-version', max_pin='x', min_pin='x') }} - - cuda-cudart - libcufile + {% endif %} + - cuda-cudart - libnvjpeg run_constrained: - {{ pin_compatible('openslide') }} From f5f3ae9843ebe01cef7e0b2506e853f3a9bd55b8 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Thu, 21 Aug 2025 22:31:30 -0700 Subject: [PATCH 02/12] Simply use `cufile.h` The CUDA Toolkit will either have `cufile.h` or not. If it has it, we can build support for cuFile. If it doesn't, we can skip it entirely. --- gds/include/cufile_stub.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/gds/include/cufile_stub.h b/gds/include/cufile_stub.h index cb90e60a0..8c6e34caa 100644 --- a/gds/include/cufile_stub.h +++ b/gds/include/cufile_stub.h @@ -16,12 +16,7 @@ #ifndef CUCIM_CUFILE_STUB_H #define CUCIM_CUFILE_STUB_H -// Try to include the real cufile.h, fall back to minimal types if not available -#if __has_include() - #include -#else - #include "cufile_stub_types.h" -#endif +#include #include "cucim/dynlib/helper.h" From 584e88c434d6f81db575e5e46eefe18a7279039d Mon Sep 17 00:00:00 2001 From: jakirkham Date: Thu, 21 Aug 2025 22:58:41 -0700 Subject: [PATCH 03/12] Require cuFile component in GDS stub --- gds/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gds/CMakeLists.txt b/gds/CMakeLists.txt index d8248130a..b7e0eebc1 100644 --- a/gds/CMakeLists.txt +++ b/gds/CMakeLists.txt @@ -25,7 +25,7 @@ if (NOT APPLE) endif () # Find CUDA Toolkit for cudart and cufile. -find_package(CUDAToolkit REQUIRED) +find_package(CUDAToolkit REQUIRED COMPONENTS cuFile) ################################################################################ # Add library: cufile_stub From 4dbfd5a6f27dee6c19a8290f8a6e1254add26eb8 Mon Sep 17 00:00:00 2001 From: Gregory Lee Date: Tue, 9 Sep 2025 11:04:55 -0400 Subject: [PATCH 04/12] Update ci/build_cpp.sh --- ci/build_cpp.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ci/build_cpp.sh b/ci/build_cpp.sh index 981d2cbb4..6ac90e372 100755 --- a/ci/build_cpp.sh +++ b/ci/build_cpp.sh @@ -27,15 +27,16 @@ sccache --zero-stats # However the CTK only added cuFile for ARM in 12.2. # So for users installing with CTK 12.0 & 12.1, relax the cuFile requirement. # On x86 or CTK 13, always require cuFile. -cat > extra_variants.yaml < extra_variants.yaml <> extra_variants.yaml < extra_variants.yaml < Date: Wed, 17 Sep 2025 17:22:04 -0700 Subject: [PATCH 05/12] Always build with `libcufile-dev` --- conda/recipes/libcucim/meta.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/conda/recipes/libcucim/meta.yaml b/conda/recipes/libcucim/meta.yaml index ec1b1d234..44d5bd396 100644 --- a/conda/recipes/libcucim/meta.yaml +++ b/conda/recipes/libcucim/meta.yaml @@ -55,12 +55,7 @@ requirements: host: - cuda-version ={{ cuda_version }} - cuda-cudart-dev - {% if aarch64 and cuda_major == "12" %} - # Skip building with `libcufile-dev` if it cannot be used at runtime - - libcufile-dev # [has_cufile] - {% else %} - libcufile-dev - {% endif %} - libnvjpeg-dev - nvtx-c >=3.1.0 - openslide From 61ab3174a0f0f1190bb88e24edfdd3b3e9d7f0ca Mon Sep 17 00:00:00 2001 From: jakirkham Date: Wed, 17 Sep 2025 18:23:14 -0700 Subject: [PATCH 06/12] Ignore `run_exports` of `libcufile-dev` on ARM too --- conda/recipes/libcucim/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conda/recipes/libcucim/meta.yaml b/conda/recipes/libcucim/meta.yaml index 44d5bd396..b24e99a18 100644 --- a/conda/recipes/libcucim/meta.yaml +++ b/conda/recipes/libcucim/meta.yaml @@ -21,7 +21,7 @@ build: ignore_run_exports_from: - {{ compiler('cuda') }} - cuda-cudart-dev - - libcufile-dev # [linux64] + - libcufile-dev - libnvjpeg-dev script_env: - AWS_ACCESS_KEY_ID From e447f6b9bab17966028386a0b50e2aeb2bd881b6 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Wed, 17 Sep 2025 19:27:05 -0700 Subject: [PATCH 07/12] Revert "Update ci/build_cpp.sh" This reverts commit 4dbfd5a6f27dee6c19a8290f8a6e1254add26eb8. --- ci/build_cpp.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/ci/build_cpp.sh b/ci/build_cpp.sh index 6ac90e372..981d2cbb4 100755 --- a/ci/build_cpp.sh +++ b/ci/build_cpp.sh @@ -27,16 +27,15 @@ sccache --zero-stats # However the CTK only added cuFile for ARM in 12.2. # So for users installing with CTK 12.0 & 12.1, relax the cuFile requirement. # On x86 or CTK 13, always require cuFile. -if [[ "$(arch)" == "aarch64" ]] && [[ "${RAPIDS_CUDA_VERSION%%.*}" == "12" ]]; then - cat > extra_variants.yaml < extra_variants.yaml < extra_variants.yaml <> extra_variants.yaml < Date: Wed, 17 Sep 2025 19:33:28 -0700 Subject: [PATCH 08/12] Tweak comment about selectively dropping cuFile --- ci/build_cpp.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/build_cpp.sh b/ci/build_cpp.sh index 981d2cbb4..2ffe6d7e2 100755 --- a/ci/build_cpp.sh +++ b/ci/build_cpp.sh @@ -25,8 +25,8 @@ sccache --zero-stats # TODO: Remove when CUDA 12.1 is dropped. # In most cases, the CTK has cuFile. # However the CTK only added cuFile for ARM in 12.2. -# So for users installing with CTK 12.0 & 12.1, relax the cuFile requirement. -# On x86 or CTK 13, always require cuFile. +# So for ARM users on CTK 12.0 & 12.1, relax the cuFile requirement. +# On x86_64 or CTK 13, always require cuFile. cat > extra_variants.yaml < Date: Wed, 17 Sep 2025 19:36:52 -0700 Subject: [PATCH 09/12] Align selectors --- conda/recipes/libcucim/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conda/recipes/libcucim/meta.yaml b/conda/recipes/libcucim/meta.yaml index b24e99a18..6ad6da320 100644 --- a/conda/recipes/libcucim/meta.yaml +++ b/conda/recipes/libcucim/meta.yaml @@ -64,7 +64,7 @@ requirements: # Relax `libcufile` dependency for old CUDA 12 ARM installs - {{ pin_compatible('cuda-version', lower_bound='12.0', upper_bound='12.2') }} # [not has_cufile] - {{ pin_compatible('cuda-version', lower_bound='12.2', upper_bound='13.0') }} # [has_cufile] - - libcufile # [has_cufile] + - libcufile # [has_cufile] {% else %} - {{ pin_compatible('cuda-version', max_pin='x', min_pin='x') }} - libcufile From 73dd61388474eeaf7f1843bdb9478278bee74a91 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Wed, 17 Sep 2025 20:33:14 -0700 Subject: [PATCH 10/12] Show what `extra_variants.yaml` contains in CI log --- ci/build_cpp.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ci/build_cpp.sh b/ci/build_cpp.sh index 2ffe6d7e2..a4f6910ba 100755 --- a/ci/build_cpp.sh +++ b/ci/build_cpp.sh @@ -38,6 +38,10 @@ then EOF fi +echo 'Contents of `extra_variants.yaml`:' +cat extra_variants.yaml +echo '' + RAPIDS_PACKAGE_VERSION=$(rapids-generate-version) rapids-conda-retry build \ -m extra_variants.yaml \ conda/recipes/libcucim From f3fa2b1a985c8a6940a4ea5fe4051748880f53ef Mon Sep 17 00:00:00 2001 From: jakirkham Date: Wed, 17 Sep 2025 20:59:38 -0700 Subject: [PATCH 11/12] Include package hash in cuCIM's build strings To ensure the different cuCIM packages with and without cuFile are both used, they need different package strings. As the new variant, `has_cufile`, is included in the package hash, make sure to include the package hash in the package string. That way each package is named differently and they don't clobber each other. Thus ensuring both packages are uploaded and not whichever one was built last. --- conda/recipes/cucim/meta.yaml | 2 +- conda/recipes/libcucim/meta.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conda/recipes/cucim/meta.yaml b/conda/recipes/cucim/meta.yaml index 4f821e4f6..2e985554f 100644 --- a/conda/recipes/cucim/meta.yaml +++ b/conda/recipes/cucim/meta.yaml @@ -16,7 +16,7 @@ source: build: number: {{ GIT_DESCRIBE_NUMBER }} - string: cuda{{ cuda_major }}_py{{ py_version }}_{{ date_string }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }} + string: cuda{{ cuda_major }}_py{{ py_version }}_{{ date_string }}_gh{{ GIT_DESCRIBE_HASH }}_gn{{ GIT_DESCRIBE_NUMBER }}}_ph{{ PKG_HASH }} ignore_run_exports_from: - {{ compiler('cuda') }} - cuda-cudart-dev diff --git a/conda/recipes/libcucim/meta.yaml b/conda/recipes/libcucim/meta.yaml index 6ad6da320..ae0a87016 100644 --- a/conda/recipes/libcucim/meta.yaml +++ b/conda/recipes/libcucim/meta.yaml @@ -15,7 +15,7 @@ source: build: number: {{ GIT_DESCRIBE_NUMBER }} - string: cuda{{ cuda_major }}_{{ date_string }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }} + string: cuda{{ cuda_major }}_{{ date_string }}_gh{{ GIT_DESCRIBE_HASH }}_gn{{ GIT_DESCRIBE_NUMBER }}}_ph{{ PKG_HASH }} ignore_run_exports: - openslide ignore_run_exports_from: From 5dbbb43b11e123b328053e739b1c39b30a7b3035 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Thu, 18 Sep 2025 11:22:52 -0700 Subject: [PATCH 12/12] Note ARM CUDA 12.2+ requires cuFile --- ci/build_cpp.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/build_cpp.sh b/ci/build_cpp.sh index a4f6910ba..66e4600f5 100755 --- a/ci/build_cpp.sh +++ b/ci/build_cpp.sh @@ -26,7 +26,7 @@ sccache --zero-stats # In most cases, the CTK has cuFile. # However the CTK only added cuFile for ARM in 12.2. # So for ARM users on CTK 12.0 & 12.1, relax the cuFile requirement. -# On x86_64 or CTK 13, always require cuFile. +# On x86_64 or CTK 13 or ARM with CTK 12.2+, always require cuFile. cat > extra_variants.yaml <