WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@rapids-bot
Copy link

@rapids-bot rapids-bot bot commented Dec 2, 2025

Forward-merge triggered by push to release/25.12 that creates a PR to keep main up-to-date. If this PR is unable to be immediately merged due to conflicts, it will remain open for the team to manually merge. See forward-merger docs for more info.

# Feature: nvImageCodec Infrastructure Setup for cuslide2

This PR adds the infrastructure and build system support for integrating nvImageCodec into the cuslide2 plugin. This is a foundational PR that sets up the dependencies, CMake configuration, and conda packaging without implementing the actual nvImageCodec functionality in the plugin.

## Changes Overview

### 1. Dependency Management
- Added nvImageCodec dependencies to `dependencies.yaml`:
  - `libnvimgcodec` (runtime library)
  - `libnvimgcodec-dev` (development headers)
  - `libnvimgcodec0` (base library)
- Regenerated all conda environment files from dependencies

### 2. Build System Updates
- Updated `cpp/plugins/cucim.kit.cuslide2/CMakeLists.txt` with nvImageCodec integration
- Added CMake dependency files in `cpp/plugins/cucim.kit.cuslide2/cmake/deps/`:
  - `cli11.cmake`, `catch2.cmake`, `boost.cmake`
  - `fmt.cmake`, `json.cmake`, `pugixml.cmake`
  - `libdeflate.cmake`, `libtiff.cmake`, `libopenjpeg.cmake`
  - `googletest.cmake`, `googlebenchmark.cmake`, `openslide.cmake`
  - Policy fix files for libjpeg-turbo and libtiff

### 3. Python Package Updates
- Updated `python/cucim/pyproject.toml` with nvImageCodec dependencies
- Ensured Python bindings are ready for future nvImageCodec integration

### 4. Verification Script
- Added `scripts/verify_cuslide2_infrastructure.py` - comprehensive infrastructure verification tool
- Checks nvImageCodec installation, library files, CMake configuration, CUDA environment, and plugin build


## Setup and Verification Instructions

### Prerequisites
- Micromamba or conda/mamba package manager
- NVIDIA GPU with appropriate drivers

### Step 1: Create and Activate Environment

```bash
# Create conda environment with all dependencies based on your CUDA system version - use all_cuda-130 for CUDA 13 and all_cuda-129 for CUDA 12
conda env create -n cucim -f ./conda/environments/all_cuda-130_arch-x86_64.yaml

# Activate environment
conda activate cucim
```

**Build cuslide2 Plugin:**
```bash

```bash
# Set compilers to use conda environment versions
export CC=$CONDA_PREFIX/bin/gcc
export CXX=$CONDA_PREFIX/bin/g++


# Set CUDA compiler (uses conda's CUDA toolkit)
export CUDACXX=$CONDA_PREFIX/pkgs/cuda-toolkit/bin/nvcc

# Build libcucim + cuslide2 plugin
./run build_local all release $CONDA_PREFIX
```

**Install Python Package:**
```bash
# Install in editable mode for development
python -m pip install --editable python/cucim
```





**Note**: The `build_local` script will:
- Install nvImageCodec packages (libnvimgcodec, libnvimgcodec-dev, libnvimgcodec0) from conda-forge based on `dependencies.yaml`
- Install additional Python and C++ dependencies from `dependencies.yaml`
- Configure and build the C++ library including the cuslide2 plugin
- Build and install the Python package

### Step 5: Run Verification Script

```bash
# From the repository root
python scripts/verify_cuslide2_infrastructure.py
```

## Verification Output

When the infrastructure is properly set up, the verification script produces the following output:

```
============================================================
 cuslide2 Infrastructure Verification
============================================================
Platform: Linux 6.8.0-1029-gcp
Python: 3.10.19 | packaged by conda-forge | (main, Oct 22 2025, 22:29:10) [GCC 14.3.0]

----------------------------------------
 nvImageCodec Installation Detection
----------------------------------------
✓ Method 1: Conda packages detected (from dependencies.yaml):
    libnvimgcodec-dev  0.6.0    h0850aa4_0  conda-forge
    libnvimgcodec0     0.6.0    hb7e823c_0  conda-forge
  Environment: /home/cdinea/micromamba/envs/cucim-test3

----------------------------------------
 nvImageCodec Library Files Check
----------------------------------------
✓ Header found: /home/cdinea/micromamba/envs/cucim-test3/include/nvimgcodec.h
✓ Library found: /home/cdinea/micromamba/envs/cucim-test3/lib/libnvimgcodec.so.0 (33.3 MB)

----------------------------------------
 CMake Build Configuration Check
----------------------------------------
✓ CMake cache found: /home/cdinea/Downloads/cucim_pr1/cucim/cpp/plugins/cucim.kit.cuslide2/build-release/CMakeCache.txt
✓ nvImageCodec configuration found in CMake cache
  AUTO_INSTALL_NVIMGCODEC:BOOL=ON
  NVIMGCODEC_VERSION:STRING=0.6.0
  nvimgcodec_DIR:PATH=/home/cdinea/micromamba/envs/cucim-test3/lib/cmake/nvimgcodec

----------------------------------------
 CUDA Environment Check
----------------------------------------
✓ NVIDIA GPU detected:
  |   0  NVIDIA RTX A6000               Off |   00000000:01:00.0  On |                  Off |
✓ CUDA compiler: Cuda compilation tools, release 12.9, V12.9.86

----------------------------------------
 cuslide2 Plugin Check
----------------------------------------
ℹ️  Infrastructure-only build detected
  ✓ This build validates dependencies without generating plugin binary
  ✓ CMake configuration verified - dependencies checked
  ℹ️  Plugin source code not yet added (planned for follow-up PR)

  📋 Infrastructure-only build is working as intended!

----------------------------------------
 Python Import Test
----------------------------------------
✓ nvidia.nvimgcodec module imported successfully
  Version: 0.6.1

============================================================
 Infrastructure Summary
============================================================
🎉 cuslide2 infrastructure validation PASSED!
✓ This is an infrastructure-only build
✓ CMake configuration verified
✓ All dependencies can be fetched/built
✓ nvImageCodec packages detected via conda

ℹ️  Note: Plugin binary intentionally not built in infrastructure-only mode
   Actual plugin implementation will be added in follow-up PR

```



## Notes

- **This PR does NOT implement nvImageCodec functionality** - it only sets up the infrastructure
- The cuslide2 plugin builds successfully with nvImageCodec dependencies available
- Future PRs will add the actual nvImageCodec codec implementation
- All existing functionality remains unchanged

## Related Issues

This is part of the work to integrate nvImageCodec support into cuCIM for improved image decoding performance.

Authors:
  - https://github.com/cdinea
  - Gil Forsyth (https://github.com/gforsyth)
  - https://github.com/jakirkham

Approvers:
  - Gigon Bae (https://github.com/gigony)
  - Kyle Edwards (https://github.com/KyleFromNVIDIA)
  - https://github.com/jakirkham

URL: #966
@rapids-bot rapids-bot bot requested review from a team as code owners December 2, 2025 23:39
@GPUtester GPUtester merged commit 84ab6d0 into main Dec 2, 2025
@rapids-bot rapids-bot bot requested a review from bdice December 2, 2025 23:39
@rapids-bot
Copy link
Author

rapids-bot bot commented Dec 2, 2025

SUCCESS - forward-merge complete.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants