Thread safe, inplace prediction. (#5389)
Normal prediction with DMatrix is now thread safe with locks. Added inplace prediction is lock free thread safe. When data is on device (cupy, cudf), the returned data is also on device. * Implementation for numpy, csr, cudf and cupy. * Implementation for dask. * Remove sync in simple dmatrix.
This commit is contained in:
@@ -63,8 +63,14 @@ def test_from_dask_dataframe():
|
||||
from_df = prediction.compute()
|
||||
|
||||
assert isinstance(prediction, dd.Series)
|
||||
assert np.all(prediction.compute().values == from_dmatrix)
|
||||
assert np.all(from_dmatrix == from_df.to_numpy())
|
||||
|
||||
series_predictions = xgb.dask.inplace_predict(client, booster, X)
|
||||
assert isinstance(series_predictions, dd.Series)
|
||||
np.testing.assert_allclose(series_predictions.compute().values,
|
||||
from_dmatrix)
|
||||
|
||||
|
||||
def test_from_dask_array():
|
||||
with LocalCluster(n_workers=5, threads_per_worker=5) as cluster:
|
||||
|
||||
Reference in New Issue
Block a user