Enable running objectives with 0 GPU. (#3878)

* Enable running objectives with 0 GPU.

* Enable 0 GPU for objectives.
* Add doc for GPU objectives.
* Fix some objectives defaulted to running on all GPUs.
This commit is contained in:
Jiaming Yuan
2018-11-13 20:19:59 +13:00
committed by GitHub
parent 97984f4890
commit daf77ca7b7
6 changed files with 56 additions and 22 deletions

View File

@@ -165,7 +165,7 @@ class GPUSet {
CHECK_GE(n_gpus, -1) << "n_gpus must be >= -1.";
GpuIdType const n_devices_visible = AllVisible().Size();
if (n_devices_visible == 0) { return Empty(); }
if (n_devices_visible == 0 || n_gpus == 0) { return Empty(); }
GpuIdType const n_available_devices = n_devices_visible - gpu_id;