De-duplicate GPU parameters. (#4454)

* Only define `gpu_id` and `n_gpus` in `LearnerTrainParam`
* Pass LearnerTrainParam through XGBoost vid factory method.
* Disable all GPU usage when GPU related parameters are not specified (fixes XGBoost choosing GPU over aggressively).
* Test learner train param io.
* Fix gpu pickling.
This commit is contained in:
Jiaming Yuan
2019-05-29 11:55:57 +08:00
committed by GitHub
parent a3fedbeaa8
commit c589eff941
69 changed files with 927 additions and 562 deletions

View File

@@ -1,5 +1,5 @@
/*!
* Copyright 2018 by Contributors
* Copyright 2018-2019 by Contributors
*/
#include "../helpers.h"
#include "../../../src/common/host_device_vector.h"
@@ -25,9 +25,10 @@ TEST(Updater, Refresh) {
{"reg_lambda", "1"}};
RegTree tree = RegTree();
auto lparam = CreateEmptyGenericParam(0, 0);
tree.param.InitAllowUnknown(cfg);
std::vector<RegTree*> trees {&tree};
std::unique_ptr<TreeUpdater> refresher(TreeUpdater::Create("refresh"));
std::unique_ptr<TreeUpdater> refresher(TreeUpdater::Create("refresh", &lparam));
tree.ExpandNode(0, 2, 0.2f, false, 0.0, 0.2f, 0.8f, 0.0f, 0.0f);
int cleft = tree[0].LeftChild();