forked from dmlc/xgboost
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dmitry Razdoburdin
committed
Sep 9, 2024
1 parent
bba6aa7
commit 51e2725
Showing
6 changed files
with
151 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from xgboost import dask as dxgb | ||
from xgboost import testing as tm | ||
|
||
from hypothesis import given, strategies, assume, settings, note | ||
|
||
import dask.array as da | ||
import dask.distributed | ||
|
||
|
||
def train_result(client, param, dtrain, num_rounds): | ||
result = dxgb.train( | ||
client, | ||
param, | ||
dtrain, | ||
num_rounds, | ||
verbose_eval=False, | ||
evals=[(dtrain, "train")], | ||
) | ||
return result | ||
|
||
|
||
class TestSYCLDask: | ||
# The simplest test verify only one node training. | ||
def test_simple(self): | ||
cluster = dask.distributed.LocalCluster(n_workers=1) | ||
client = dask.distributed.Client(cluster) | ||
|
||
param = {} | ||
param["tree_method"] = "hist" | ||
param["device"] = "sycl" | ||
param["verbosity"] = 0 | ||
param["objective"] = "reg:squarederror" | ||
|
||
# X and y must be Dask dataframes or arrays | ||
num_obs = 1e4 | ||
num_features = 20 | ||
X = da.random.random(size=(num_obs, num_features), chunks=(1000, num_features)) | ||
y = da.random.random(size=(num_obs, 1), chunks=(1000, 1)) | ||
dtrain = dxgb.DaskDMatrix(client, X, y) | ||
|
||
result = train_result(client, param, dtrain, 10) | ||
assert tm.non_increasing(result["history"]["train"]["rmse"]) |