Cleanup Python GPU tests. (#9934)

* Cleanup Python GPU tests.

- Remove the use of `gpu_hist` and `gpu_id` in cudf/cupy tests.
- Move base margin test into the testing directory.
This commit is contained in:
Jiaming Yuan
2024-01-04 13:15:18 +08:00
committed by GitHub
parent 3c004a4145
commit 9f73127a23
14 changed files with 282 additions and 240 deletions

View File

@@ -203,9 +203,7 @@ class TestQuantileDMatrix:
np.testing.assert_equal(h_ret.indptr, d_ret.indptr)
np.testing.assert_equal(h_ret.indices, d_ret.indices)
booster = xgb.train(
{"tree_method": "hist", "device": "cuda:0"}, dtrain=d_m
)
booster = xgb.train({"tree_method": "hist", "device": "cuda:0"}, dtrain=d_m)
np.testing.assert_allclose(
booster.predict(d_m),
@@ -215,6 +213,7 @@ class TestQuantileDMatrix:
def test_ltr(self) -> None:
import cupy as cp
X, y, qid, w = tm.make_ltr(100, 3, 3, 5)
# make sure GPU is used to run sketching.
cpX = cp.array(X)