Offload some configurations into GBM. (#4553)

This is part 1 of refactoring configuration.

* Move tree heuristic configurations.
* Split up declarations and definitions for GBTree.
* Implement UseGPU in gbm.
This commit is contained in:
Jiaming Yuan
2019-06-14 09:18:51 +08:00
committed by GitHub
parent a2042b685a
commit c5719cc457
12 changed files with 630 additions and 519 deletions

View File

@@ -37,6 +37,7 @@ GPUSet GPUSet::All(GpuIdType gpu_id, GpuIdType n_gpus, int32_t n_rows) {
CHECK_GE(n_gpus, -1) << "n_gpus must be >= -1.";
GpuIdType const n_devices_visible = AllVisible().Size();
CHECK_LE(n_gpus, n_devices_visible);
if (n_devices_visible == 0 || n_gpus == 0 || n_rows == 0) {
LOG(DEBUG) << "Runing on CPU.";
return Empty();

View File

@@ -360,7 +360,9 @@ struct HostDeviceVectorImpl {
void Shard(const GPUDistribution& distribution) {
if (distribution_ == distribution) { return; }
CHECK(distribution_.IsEmpty());
CHECK(distribution_.IsEmpty())
<< "This: " << distribution_.Devices().Size() << ", "
<< "Others: " << distribution.Devices().Size();
distribution_ = distribution;
InitShards();
}