Skip to content

Commit

Permalink
[CI] Various CI fixes (#11196)
Browse files Browse the repository at this point in the history
* Fix #10752 (#10972)

* Fix #10752

* [CI] Replace Mambaforge -> Miniforge3

* Fix formatting

* Increase timeout for Multi-GPU approx tests. (#11111)

* Fix tests with the latest scikit-learn. (#11086)

* Fix tests with the latest scikit-learn.

* dask.

* Remove scikit-learn pin

---------

Co-authored-by: Philip Hyunsu Cho <[email protected]>

* Revert base class change

* SYCL. Fix CI failures (#10987)

* [CI] Use Python 3.10 + latest sklearn in Windows

* Increase timeout in C++ tests from 1 to 5 seconds. (#10756)

To avoid CI failures on FreeBSD.

* [CI] Pin sklearn to 1.5.2

* [CI] Apply part of #10434

---------

Co-authored-by: Jiaming Yuan <[email protected]>
Co-authored-by: Dmitry Razdoburdin <[email protected]>
  • Loading branch information
3 people authored Feb 4, 2025
1 parent a406528 commit fc32798
Show file tree
Hide file tree
Showing 26 changed files with 51 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/jvm_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

- uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4
with:
miniforge-variant: Mambaforge
miniforge-variant: Miniforge3
miniforge-version: latest
activate-environment: jvm_tests
environment-file: tests/ci_build/conda_env/jvm_tests.yml
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
submodules: 'true'
- uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4
with:
miniforge-variant: Mambaforge
miniforge-variant: Miniforge3
miniforge-version: latest
activate-environment: linux_sycl_test
environment-file: tests/ci_build/conda_env/linux_sycl_test.yml
Expand Down Expand Up @@ -123,7 +123,7 @@ jobs:
submodules: 'true'
- uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4
with:
miniforge-variant: Mambaforge
miniforge-variant: Miniforge3
miniforge-version: latest
activate-environment: cpp_test
environment-file: tests/ci_build/conda_env/cpp_test.yml
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/python_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
submodules: 'true'
- uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4
with:
miniforge-variant: Mambaforge
miniforge-variant: Miniforge3
miniforge-version: latest
activate-environment: python_lint
environment-file: tests/ci_build/conda_env/python_lint.yml
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:
submodules: 'true'
- uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4
with:
miniforge-variant: Mambaforge
miniforge-variant: Miniforge3
miniforge-version: latest
activate-environment: sdist_test
environment-file: tests/ci_build/conda_env/sdist_test.yml
Expand Down Expand Up @@ -130,7 +130,7 @@ jobs:

- uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4
with:
miniforge-variant: Mambaforge
miniforge-variant: Miniforge3
miniforge-version: latest
activate-environment: macos_cpu_test
environment-file: tests/ci_build/conda_env/macos_cpu_test.yml
Expand Down Expand Up @@ -227,7 +227,7 @@ jobs:

- uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4
with:
miniforge-variant: Mambaforge
miniforge-variant: Miniforge3
miniforge-version: latest
activate-environment: linux_cpu_test
environment-file: tests/ci_build/conda_env/linux_cpu_test.yml
Expand Down Expand Up @@ -280,7 +280,7 @@ jobs:

- uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4
with:
miniforge-variant: Mambaforge
miniforge-variant: Miniforge3
miniforge-version: latest
activate-environment: linux_sycl_test
environment-file: tests/ci_build/conda_env/linux_sycl_test.yml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: brew install libomp
- uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4
with:
miniforge-variant: Mambaforge
miniforge-variant: Miniforge3
miniforge-version: latest
python-version: 3.9
use-mamba: true
Expand Down
2 changes: 1 addition & 1 deletion plugin/sycl/common/hist_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "../data/gradient_index.h"
#include "hist_util.h"

#include <CL/sycl.hpp>
#include <sycl/sycl.hpp>

namespace xgboost {
namespace sycl {
Expand Down
2 changes: 1 addition & 1 deletion plugin/sycl/common/hist_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "../../src/common/hist_util.h"
#include "../data/gradient_index.h"

#include <CL/sycl.hpp>
#include <sycl/sycl.hpp>

namespace xgboost {
namespace sycl {
Expand Down
2 changes: 1 addition & 1 deletion plugin/sycl/common/partition_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "../data/gradient_index.h"
#include "../tree/expand_entry.h"

#include <CL/sycl.hpp>
#include <sycl/sycl.hpp>

namespace xgboost {
namespace sycl {
Expand Down
2 changes: 1 addition & 1 deletion plugin/sycl/common/row_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include "../data.h"

#include <CL/sycl.hpp>
#include <sycl/sycl.hpp>

namespace xgboost {
namespace sycl {
Expand Down
2 changes: 1 addition & 1 deletion plugin/sycl/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include "../../src/common/threading_utils.h"

#include "CL/sycl.hpp"
#include <sycl/sycl.hpp>

namespace xgboost {
namespace sycl {
Expand Down
2 changes: 1 addition & 1 deletion plugin/sycl/data/gradient_index.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "gradient_index.h"

#include <CL/sycl.hpp>
#include <sycl/sycl.hpp>

namespace xgboost {
namespace sycl {
Expand Down
2 changes: 1 addition & 1 deletion plugin/sycl/data/gradient_index.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "../data.h"
#include "../../src/common/hist_util.h"

#include <CL/sycl.hpp>
#include <sycl/sycl.hpp>

namespace xgboost {
namespace sycl {
Expand Down
2 changes: 1 addition & 1 deletion plugin/sycl/device_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <string>
#include <unordered_map>

#include <CL/sycl.hpp>
#include <sycl/sycl.hpp>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wtautological-constant-compare"
Expand Down
2 changes: 1 addition & 1 deletion plugin/sycl/objective/multiclass_obj.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "../../../src/objective/multiclass_param.h"

#include "../device_manager.h"
#include <CL/sycl.hpp>
#include <sycl/sycl.hpp>

namespace xgboost {
namespace sycl {
Expand Down
3 changes: 2 additions & 1 deletion plugin/sycl/objective/regression_obj.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wtautological-constant-compare"
#include "../../../src/objective/regression_loss.h"
#include "../../../src/objective/adaptive.h"
#pragma GCC diagnostic pop
#include "../../../src/objective/regression_param.h"

#include "../device_manager.h"

#include <CL/sycl.hpp>
#include <sycl/sycl.hpp>

namespace xgboost {
namespace sycl {
Expand Down
2 changes: 1 addition & 1 deletion plugin/sycl/predictor/predictor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <limits>
#include <mutex>

#include <CL/sycl.hpp>
#include <sycl/sycl.hpp>

#include "../data.h"

Expand Down
2 changes: 1 addition & 1 deletion plugin/sycl/tree/param.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "../src/tree/param.h"
#pragma GCC diagnostic pop

#include <CL/sycl.hpp>
#include <sycl/sycl.hpp>

namespace xgboost {
namespace sycl {
Expand Down
2 changes: 1 addition & 1 deletion plugin/sycl/tree/split_evaluator.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "../../src/common/math.h"
#include "../../src/tree/param.h"

#include <CL/sycl.hpp>
#include <sycl/sycl.hpp>

namespace xgboost {
namespace sycl {
Expand Down
2 changes: 1 addition & 1 deletion tests/ci_build/Dockerfile.gpu
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ARG NCCL_VERSION_ARG

# Environment
ENV DEBIAN_FRONTEND noninteractive
SHELL ["/bin/bash", "-c"] # Use Bash as shell
SHELL ["/bin/bash", "-c"]

# Install all basic requirements
RUN \
Expand Down
1 change: 1 addition & 0 deletions tests/ci_build/conda_env/linux_sycl_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ dependencies:
- pytest-cov
- dpcpp_linux-64
- onedpl-devel
- intel-openmp
4 changes: 2 additions & 2 deletions tests/ci_build/conda_env/win64_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: win64_env
channels:
- conda-forge
dependencies:
- python=3.8
- python=3.10
- numpy
- scipy
- matplotlib
- scikit-learn
- scikit-learn<=1.5.2
- pandas
- pytest
- boto3
Expand Down
6 changes: 3 additions & 3 deletions tests/cpp/collective/test_worker.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,13 @@ template <typename WorkerFn>
void TestDistributedGlobal(std::int32_t n_workers, WorkerFn worker_fn, bool need_finalize = true,
std::chrono::seconds test_timeout = std::chrono::seconds{30}) {
system::SocketStartup();
std::chrono::seconds timeout{1};
std::chrono::seconds poll_timeout{5};

std::string host;
auto rc = GetHostAddress(&host);
SafeColl(rc);

RabitTracker tracker{MakeTrackerConfig(host, n_workers, timeout)};
RabitTracker tracker{MakeTrackerConfig(host, n_workers, poll_timeout)};
auto fut = tracker.Run();

std::vector<std::thread> workers;
Expand All @@ -165,7 +165,7 @@ void TestDistributedGlobal(std::int32_t n_workers, WorkerFn worker_fn, bool need
for (std::int32_t i = 0; i < n_workers; ++i) {
workers.emplace_back([=] {
auto fut = std::async(std::launch::async, [=] {
auto config = MakeDistributedTestConfig(host, port, timeout, i);
auto config = MakeDistributedTestConfig(host, port, poll_timeout, i);
Init(config);
worker_fn();
if (need_finalize) {
Expand Down
8 changes: 4 additions & 4 deletions tests/cpp/common/test_quantile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -283,22 +283,22 @@ void TestColSplitQuantile(size_t rows, size_t cols) {
}
} // anonymous namespace

TEST(Quantile, ColSplitBasic) {
TEST(Quantile, ColumnSplitBasic) {
constexpr size_t kRows = 10, kCols = 10;
TestColSplitQuantile<false>(kRows, kCols);
}

TEST(Quantile, ColSplit) {
TEST(Quantile, ColumnSplit) {
constexpr size_t kRows = 4000, kCols = 200;
TestColSplitQuantile<false>(kRows, kCols);
}

TEST(Quantile, ColSplitSortedBasic) {
TEST(Quantile, ColumnSplitSortedBasic) {
constexpr size_t kRows = 10, kCols = 10;
TestColSplitQuantile<true>(kRows, kCols);
}

TEST(Quantile, ColSplitSorted) {
TEST(Quantile, ColumnSplitSorted) {
constexpr size_t kRows = 4000, kCols = 200;
TestColSplitQuantile<true>(kRows, kCols);
}
Expand Down
8 changes: 4 additions & 4 deletions tests/cpp/tree/test_approx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ void TestColumnSplitPartitioner(size_t n_samples, size_t base_rowid, std::shared
}
} // anonymous namespace

TEST(Approx, PartitionerColSplit) {
TEST(Approx, PartitionerColumnSplit) {
size_t n_samples = 1024, n_features = 16, base_rowid = 0;
auto const Xy = RandomDataGenerator{n_samples, n_features, 0}.GenerateDMatrix(true);
auto hess = GenerateHess(n_samples);
Expand Down Expand Up @@ -153,7 +153,7 @@ TEST(Approx, PartitionerColSplit) {
}

namespace {
class TestApproxColSplit : public ::testing::TestWithParam<std::tuple<bool, float>> {
class TestApproxColumnSplit : public ::testing::TestWithParam<std::tuple<bool, float>> {
public:
void Run() {
auto [categorical, sparsity] = GetParam();
Expand All @@ -162,9 +162,9 @@ class TestApproxColSplit : public ::testing::TestWithParam<std::tuple<bool, floa
};
} // namespace

TEST_P(TestApproxColSplit, Basic) { this->Run(); }
TEST_P(TestApproxColumnSplit, Basic) { this->Run(); }

INSTANTIATE_TEST_SUITE_P(ColumnSplit, TestApproxColSplit, ::testing::ValuesIn([]() {
INSTANTIATE_TEST_SUITE_P(ColumnSplit, TestApproxColumnSplit, ::testing::ValuesIn([]() {
std::vector<std::tuple<bool, float>> params;
for (auto categorical : {true, false}) {
for (auto sparsity : {0.0f, 0.6f}) {
Expand Down
10 changes: 5 additions & 5 deletions tests/cpp/tree/test_quantile_hist.cc
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,12 @@ void TestColumnSplitPartitioner(bst_target_t n_targets) {
}
} // anonymous namespace

TEST(QuantileHist, PartitionerColSplit) { TestColumnSplitPartitioner<CPUExpandEntry>(1); }
TEST(QuantileHist, PartitionerColumnSplit) { TestColumnSplitPartitioner<CPUExpandEntry>(1); }

TEST(QuantileHist, MultiPartitionerColSplit) { TestColumnSplitPartitioner<MultiExpandEntry>(3); }
TEST(QuantileHist, MultiPartitionerColumnSplit) { TestColumnSplitPartitioner<MultiExpandEntry>(3); }

namespace {
class TestHistColSplit : public ::testing::TestWithParam<std::tuple<bst_target_t, bool, float>> {
class TestHistColumnSplit : public ::testing::TestWithParam<std::tuple<bst_target_t, bool, float>> {
public:
void Run() {
auto [n_targets, categorical, sparsity] = GetParam();
Expand All @@ -212,9 +212,9 @@ class TestHistColSplit : public ::testing::TestWithParam<std::tuple<bst_target_t
};
} // anonymous namespace

TEST_P(TestHistColSplit, Basic) { this->Run(); }
TEST_P(TestHistColumnSplit, Basic) { this->Run(); }

INSTANTIATE_TEST_SUITE_P(ColumnSplit, TestHistColSplit, ::testing::ValuesIn([]() {
INSTANTIATE_TEST_SUITE_P(ColumnSplit, TestHistColumnSplit, ::testing::ValuesIn([]() {
std::vector<std::tuple<bst_target_t, bool, float>> params;
for (auto categorical : {true, false}) {
for (auto sparsity : {0.0f, 0.6f}) {
Expand Down
11 changes: 5 additions & 6 deletions tests/python-gpu/test_gpu_prediction.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ def test_predict_leaf_dart(self, param: dict, dataset: tm.TestDataset) -> None:
)
@settings(deadline=None, max_examples=20, print_blob=True)
def test_predict_categorical_split(self, df):
from sklearn.metrics import mean_squared_error
from sklearn.metrics import root_mean_squared_error

df = df.astype("category")
x0, x1 = df["x0"].to_numpy(), df["x1"].to_numpy()
Expand All @@ -480,7 +480,7 @@ def test_predict_categorical_split(self, df):
)
bst.set_param({"device": "cuda:0"})
pred = bst.predict(dtrain)
rmse = mean_squared_error(y_true=y, y_pred=pred, squared=False)
rmse = root_mean_squared_error(y_true=y, y_pred=pred)
np.testing.assert_almost_equal(
rmse, eval_history["train"]["rmse"][-1], decimal=5
)
Expand Down Expand Up @@ -576,10 +576,9 @@ def test_dtypes(self):
# boolean
orig = cp.random.binomial(1, 0.5, size=rows * cols).reshape(rows, cols)
predt_orig = booster.inplace_predict(orig)
for dtype in [cp.bool8, cp.bool_]:
X = cp.array(orig, dtype=dtype)
predt = booster.inplace_predict(X)
cp.testing.assert_allclose(predt, predt_orig)
X = cp.array(orig, dtype=cp.bool_)
predt = booster.inplace_predict(X)
cp.testing.assert_allclose(predt, predt_orig)

# unsupported types
for dtype in [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
pytestmark = [
pytest.mark.skipif(**tm.no_dask()),
pytest.mark.skipif(**tm.no_dask_cuda()),
tm.timeout(60),
tm.timeout(120),
]

from ..test_with_dask.test_with_dask import generate_array
Expand Down Expand Up @@ -99,6 +99,8 @@ def is_df(part: T) -> T:

cp.testing.assert_allclose(predt.values.compute(), single_node)

# Work around https://github.com/dmlc/xgboost/issues/10752
X.columns = X.columns.astype("object")
# Make sure the output can be integrated back to original dataframe
X["predict"] = predictions
X["inplace_predict"] = series_predictions
Expand Down

0 comments on commit fc32798

Please sign in to comment.