(self)
| 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) |
nothing calls this directly
no test coverage detected