Skip to content

[ci] Run cross platform tests#11955

Merged
trivialfis merged 2 commits intodmlc:masterfrom
trivialfis:ci-cross-jobs-tests
Feb 4, 2026
Merged

[ci] Run cross platform tests#11955
trivialfis merged 2 commits intodmlc:masterfrom
trivialfis:ci-cross-jobs-tests

Conversation

@trivialfis
Copy link
Copy Markdown
Member

@trivialfis trivialfis commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds CI coverage for cross-platform model portability by training an XGBoost model on Linux GPU, then validating inference on macOS using a freshly built macOS wheel.

Changes:

  • Add a cross-platform model train/inference script to generate and validate a portable model artifact.
  • Extend main.yml to build macOS wheels and run a macOS inference job using a model artifact trained on Linux GPU.
  • Update lint and macOS test environment configs to include the new test directory and adjust dependencies.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/cross-platform/test_cross_platform_model.py New script to train a model (GPU) and validate inference on another platform.
ops/script/lint_python.py Adds the new test directory to formatting/type-check paths.
ops/conda_env/macos_cpu_test.yml Updates macOS CI env deps (notably unpins dask/distributed).
.github/workflows/python_wheels_macos.yml Removes standalone macOS wheel workflow (functionality moved into main.yml).
.github/workflows/main.yml Adds macOS wheel build job and macOS inference job; uploads/downloads the cross-platform model artifact.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/main.yml Outdated
Comment thread .github/workflows/main.yml
Comment on lines +42 to +60
accuracy = accuracy_score(y, clf.predict(X))

clf.get_booster().set_attr(expected_accuracy=str(accuracy))
clf.save_model(model_path)


def test_inference(model_path: str) -> None:
"""Load model, run inference and verify accuracy matches."""
X, y = get_data()

clf = xgb.XGBClassifier()
clf.load_model(model_path)

accuracy = accuracy_score(y, clf.predict(X))
ea = clf.get_booster().attr("expected_accuracy")
assert ea is not None
expected_accuracy = float(ea)

np.testing.assert_allclose(accuracy, expected_accuracy)
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

This test only asserts that the accuracy matches across platforms, which can miss cross-platform inference differences (e.g., prediction changes that happen to preserve overall accuracy). To make the cross-platform check meaningful, persist a stronger signal in the trained model artifact (e.g., a checksum of predictions/probabilities on a fixed dataset, or the raw prediction vector) and compare that in inference.

Copilot uses AI. Check for mistakes.
Comment thread ops/conda_env/macos_cpu_test.yml
@trivialfis
Copy link
Copy Markdown
Member Author

I downloaded the model and tested it on a local Linux build and a local Windows build. Both work as expected. Not sure what I'm doing wrong with the macos CI test job here

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/cross-platform/test_cross_platform_model.py
Comment thread tests/cross-platform/test_cross_platform_model.py
Comment thread .github/workflows/main.yml
Comment thread .github/workflows/main.yml Outdated
@hcho3
Copy link
Copy Markdown
Collaborator

hcho3 commented Jan 29, 2026

It turns out that the OpenMP configuration logic is buggy. The find_openmp_macos function in dmlc-core shadows the find_openmp_macos function in XGBoost. As a result, libxgboost.dylib is not properly patched to use the correct libomp.dylib. We will need dmlc/dmlc-core#719 to fix it.

@trivialfis
Copy link
Copy Markdown
Member Author

!!
That's so very weird. Thank you for looking into this! I wouldn't thought of it. The omp seems tricky, based on the #11944 (comment) I will see if I can get access to a mac

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/cross-platform/test_cross_platform_model.py
Comment on lines +577 to +588
test-cross-platform-inference:
name: Cross-platform inference test (macOS Apple Silicon)
needs: [test-python-wheel-gpu, python-wheels-macos]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: macos-15-intel
platform_id: macosx_x86_64
- os: macos-14
platform_id: macosx_arm64
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

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

The job name says "(macOS Apple Silicon)", but the matrix includes both macos-15-intel and macos-14 runners. Please rename the job to reflect both architectures (or restrict the matrix to Apple Silicon only) to avoid confusion when reading CI results.

Copilot uses AI. Check for mistakes.
@trivialfis trivialfis changed the title [wip][ci] Run cross platform tests [ci] Run cross platform tests Jan 30, 2026
@trivialfis trivialfis marked this pull request as ready for review January 30, 2026 10:40
@trivialfis trivialfis requested a review from hcho3 January 30, 2026 10:41
@trivialfis
Copy link
Copy Markdown
Member Author

@hcho3 Please help take a look when you are available. I will follow up with the macos issues and check whether everything is in good shape (reasonably)

version.

version.

shell.

Update .github/workflows/main.yml

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

try to specify the macos tag.

Use minimal env.

test x86.

Update .github/workflows/main.yml

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

remove homebrew setup.
@trivialfis trivialfis merged commit 5799dab into dmlc:master Feb 4, 2026
78 checks passed
@trivialfis trivialfis deleted the ci-cross-jobs-tests branch February 4, 2026 09:42
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