课程评价 (0)

请对课程作出评价:
0/300

学员评价

暂无精选评价
7分钟

GPU计算

1. xgboost 支持使用gpu 计算,前提是安装时开启了GPU 支持

2. 要想使用GPU 训练,需要指定tree_method 参数为下列的值:

  • 'gpu_exact': 标准的xgboost 算法。它会对每个分裂点进行精确的搜索。相对于'gpu_hist',它的训练速度更慢,占用更多内存
  • 'gpu_hist':使用xgboost histogram 近似算法。它的训练速度更快,占用更少内存

3. 当tree_method'gpu_exact','gpu_hist' 时,模型的predict 默认采用GPU 加速。 你可以通过设置predictor 参数来指定predict 时的计算设备:

  • 'cpu_predictor': 使用CPU 来执行模型预测
  • 'gpu_predictor': 使用GPU 来执行模型预测

4. 多GPU 可以通过grow_gpu_hist 参数和 n_gpus 参数配合使用。

  • 可以通过gpu_id 参数来选择设备,默认为 0 。如果非0,则GPU 的编号规则为 mod(gpu_id + i) % n_visible_devices for i in 0~n_gpus-1
  • 如果n_gpus 设置为 -1,则所有的GPU 都被使用。它默认为 1 。

5. 多GPU 不一定比单个GPU 更快,因为PCI总线的带宽限制,数据传输速度可能成为瓶颈。

6. GPU 计算支持的参数:

parameter

gpu_exact

gpu_hist

subsample

colsample_bytree

colsample_bylevel

max_bin

gpu_id

n_gpus

predictor

grow_policy

monotone_constraints