Skip to content

[CI] Use rapids-dependency-file-generator to generate pyproject.toml #10803

@hcho3

Description

@hcho3

Currently, we use a patch to remove nvidia-nccl-cu12 from the dependencies when building the CPU wheel:

diff --git python-package/pyproject.toml python-package/pyproject.toml
index 20d3f9974..953087ff4 100644
--- python-package/pyproject.toml
+++ python-package/pyproject.toml
@@ -30,7 +30,6 @@ classifiers = [
dependencies = [
"numpy",
"scipy",
- "nvidia-nccl-cu12 ; platform_system == 'Linux' and platform_machine != 'aarch64'",
]
[project.urls]

This approach has several disadvantages:

  • Fragility: Future changes to the original file may break the patch.
  • Cannot accommodate multiple CUDA versions. The patch bakes in the assumption that we are only building wheels for CPU and CUDA 12 targets. What happens when we also want a wheel for CUDA 11 ?

Proposal. Use rapids-dependency-file-generator to modify the dependencies section in pyproject.toml.
The tool is standalone and lightweight, and can be easily integrated in our CI/CD pipelines.

The following configuration will let us generate three variants (CPU, CUDA 11, CUDA 12):

# dependencies.yaml

files:
  pyproject:
    output: pyproject
    pyproject_dir: python-package
    matrix:
      cuda: ["none", "11.8", "12.4"]
    includes:
      - deps
    extras:
      table: project
dependencies:
  deps:
    common:
      - output_types: pyproject
        packages:
          - numpy
          - scipy
    specific:
      - output_types: pyproject
        matrices:
          - matrix:
              cuda: "11.8"
            packages:
              - nvidia-nccl-cu11 ; platform_system == 'Linux' and platform_machine != 'aarch64'
          - matrix:
              cuda: "12.4"
            packages:
              - nvidia-nccl-cu12 ; platform_system == 'Linux' and platform_machine != 'aarch64'
          # Don't add NCCL dep for CPU package
          - matrix:
            packages:

Command: rapids-dependency-file-generator --file-key pyproject --output pyproject --matrix cuda=12.4

cc @jameslamb

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions