Skip to content

Conversation

@akshaver
Copy link

Fixes-102, Fixes-306, Fixes-401, Fixes-579

What

This MR introduces four patches that add GPU support to docker-slim and fix critical symlink processing bugs:

  1. Implement docker device request in CLI - Adds --cro-device-request and --cro-runtime CLI flags to enable GPU access during container profiling. Allows passing device requests as JSON (e.g., --cro-device-request '{"Count":-1, "Capabilities":[["gpu"]]}' --cro-runtime nvidia).

  2. Fix issues with duplicate symlink processing - Resolves a bug where files accessed through multiple symlinked paths (e.g., /usr/local/cuda/ vs /usr/local/cuda-12.9/) would be copied multiple times, with later copies randomly overwriting with 0-byte content. Implements inode-based deduplication to ensure only one canonical copy is kept.

  3. Example use case with nvidia runtime - Adds documentation and example scripts demonstrating GPU workloads:

    • test_nvidia_smi.sh - Slims ubuntu to run nvidia-smi
    • test_nvidia_pytorch.sh - Slims nvidia-pytorch to run CUDA tests
  4. Non-trivial example of slimming vllm - Adds a comprehensive example for slimming VLLM (LLM inference) containers with full API test suite validation.

Why

How Tested

  • Unit Tests: Added comprehensive test coverage for:

    • Device request JSON parsing and CLI flag handling (clifvgetter_test.go, config_test.go, device_request_test.go)
    • Symlink deduplication logic (dedup_test.go)
    • Ptrace return status handling (ptrace_test.go)
    • File copy operations (fsutil_test.go)
  • Integration Tests:

    • test_nvidia_smi.sh - Verifies slimmed ubuntu image can run nvidia-smi with identical output to original
    • test_nvidia_pytorch.sh - Verifies slimmed pytorch image passes CUDA tests
    • test_nvidia_vllm.sh - Comprehensive VLLM API test suite comparing original vs slimmed image behavior (15 endpoint tests)
  • Manual Testing: Successfully slimmed NVIDIA NIM LLM containers with GPU workloads and verified functional parity.

Now one can pass in the cro runtime and GPU like
  --cro-device-request '{"Count":-1, \
    "Capabilities":[["gpu"]]}' \
  --cro-runtime nvidia \
Correct issues with duplicate paths from symlink
processing, when they both point to the same
inode. This fixes a behavior where slimtookit
would randomly generate o-byte files for the
actual file referenced by the symlink.
@kcq
Copy link
Member

kcq commented Jan 31, 2026

thanks for the PR @akshaver ! Do you mind moving it here , so it'll be easier to review and integrate.

@akshaver
Copy link
Author

akshaver commented Feb 2, 2026

thanks for the PR @akshaver ! Do you mind moving it here , so it'll be easier to review and integrate.

Will do.

@akshaver akshaver closed this Feb 2, 2026
@akshaver akshaver deleted the ashaver/cro_runtime branch February 2, 2026 18:03
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.

2 participants