Skip to content

Fix static treelite flag while in Conda env - #8895

Open
chyunsu3 wants to merge 1 commit into
NVIDIA:mainfrom
chyunsu3:static_treelite_fix
Open

chyunsu3 wants to merge 1 commit into
NVIDIA:mainfrom
chyunsu3:static_treelite_fix

Conversation

@chyunsu3

Copy link
Copy Markdown
Contributor

Addresses #8262 (comment)

I tested this change by running the following inside the Conda env:

conda activate cuml_dev
conda install -c rapidsai-nightly -c rapidsai -c conda-forge cuda-tileiras \
  cutile-python cuda-version=13.3
./build.sh -v --static-treelite libcuml

which printed

-- Found Treelite (found version "4.8.1")
-- Downloading Treelite to use Treelite static lib; current env only offers shared Treelite lib
-- CPM: Adding package Treelite@4.8.1 (79c2fe214fd0619e39ee6b915a64c49389e625c5)

@coderabbitai

coderabbitai Bot commented Nov 11, 2026

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Static Treelite builds can now fall back to downloading Treelite when an installed package does not provide the required static library.

Static Treelite setup now checks for an installed package when static libraries are requested. If the static target is unavailable, it enables the CPM download option.

Changes: Treelite static dependency

Layer / File(s) Summary
Installed package check and CPM fallback
cpp/cmake/thirdparty/get_treelite.cmake
The function quietly searches for the requested Treelite version when static libraries are requested. If treelite::treelite_static is unavailable, it enables CPM_DOWNLOAD_Treelite and reports that Treelite will be downloaded.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: kylefromnvidia

Merge Risk: Minimal · up to 35e10

The change makes static Treelite builds fall back to a download when Conda provides only the shared library. A minor alias-export edge case remains, but it does not block merging.

Architecture risk: Low · up to 35e10

The change affects 1 system.

Changed systems: cpp

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — cpp (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in cpp/cmake/thirdparty/get_treelite.cmake: When static libraries are requested, the function now quietly searches for the requested Treelite version and enables CPM_DOWNLOAD_Treelite with a status message if treelite::treelite_static is not available.
Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title clearly identifies the main change: fixing the static Treelite flag in a Conda environment.
Description check Passed The description explains the problem, references the related discussion, and documents validation with the relevant build command and output. It does not use the required Summary heading or a GitHub c…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the problem, references the related discussion, and documents validation with the relevant build command and output. It does not use the required Summary heading or a GitHub closing keyword, but the provided information is sufficient and on topic.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: NVIDIA/cuml
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 106c73f
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: d9e3e009-bed6-48cf-a308-483e889402f3
Commits

Reviewing files that changed from the base of the PR and between 106c73f and 35e108a.

Files selected for processing: 1

  • cpp/cmake/thirdparty/get_treelite.cmake

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

else()
list(APPEND TREELITE_LIBS treelite::treelite_static)
# Installed Treelite packages may only provide the shared library.
find_package(Treelite ${PKG_VERSION} QUIET CONFIG)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This would cause CPM_Treelite_SOURCE to be ignored when an installed Treelite package provides treelite::treelite_static: the early find_package() call creates that target, so rapids_cpm_find() skips CPM rather than using the requested source checkout.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could we just set CPM_DOWNLOAD_Treelite to ON in the static branch and leave source selection to rapids_cpm_find()? That would avoid the early find_package() call, preserve CPM_Treelite_SOURCE, and handle shared-only Conda installations. I think always building Treelite from source when static linking is requested is a reasonable trade-off.

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