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:
@@ -4,15 +4,16 @@
|
||||
#include "../helpers.h"
|
||||
|
||||
TEST(Metric, UnknownMetric) {
|
||||
auto tparam = xgboost::CreateEmptyGenericParam(0, 0);
|
||||
xgboost::Metric * metric = nullptr;
|
||||
EXPECT_ANY_THROW(metric = xgboost::Metric::Create("unknown_name"));
|
||||
EXPECT_NO_THROW(metric = xgboost::Metric::Create("rmse"));
|
||||
EXPECT_ANY_THROW(metric = xgboost::Metric::Create("unknown_name", &tparam));
|
||||
EXPECT_NO_THROW(metric = xgboost::Metric::Create("rmse", &tparam));
|
||||
if (metric) {
|
||||
delete metric;
|
||||
}
|
||||
metric = nullptr;
|
||||
EXPECT_ANY_THROW(metric = xgboost::Metric::Create("unknown_name@1"));
|
||||
EXPECT_NO_THROW(metric = xgboost::Metric::Create("error@0.5f"));
|
||||
EXPECT_ANY_THROW(metric = xgboost::Metric::Create("unknown_name@1", &tparam));
|
||||
EXPECT_NO_THROW(metric = xgboost::Metric::Create("error@0.5f", &tparam));
|
||||
if (metric) {
|
||||
delete metric;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user