MCPcopy Create free account
hub / github.com/dmlc/xgboost / test_wrap_gpu_id

Method test_wrap_gpu_id

tests/python-gpu/test_gpu_pickling.py:90–109  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

88
89 @pytest.mark.mgpu
90 def test_wrap_gpu_id(self) -> None:
91 X, y = build_dataset()
92 dtrain = xgb.DMatrix(X, y)
93
94 bst = xgb.train(
95 {"tree_method": "hist", "device": "cuda:1"}, dtrain, num_boost_round=6
96 )
97
98 model_path = "model.pkl"
99 save_pickle(bst, model_path)
100 cuda_environment = {"CUDA_VISIBLE_DEVICES": "0"}
101 env = os.environ.copy()
102 env.update(cuda_environment)
103 args = self.args_template.copy()
104 args.append(
105 "./tests/python-gpu/" "load_pickle.py::TestLoadPickle::test_wrap_gpu_id"
106 )
107 status = subprocess.call(args, env=env)
108 assert status == 0
109 os.remove(model_path)
110
111 def test_pickled_context(self) -> None:
112 x, y = tm.make_sparse_regression(10, 10, sparsity=0.8, as_dense=True)

Callers

nothing calls this directly

Calls 7

build_datasetFunction · 0.85
save_pickleFunction · 0.85
copyMethod · 0.80
removeMethod · 0.80
DMatrixMethod · 0.45
trainMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected