训练XGBoost模型时如何使用Intel集成GPU?
问题:XGBoost无法识别Intel Iris Xe集成GPU
设备与环境
- 设备:戴尔Vostro 15 5510
- GPU:Intel(R) Iris(R) Xe Graphics
- XGBoost安装方式:
pip install xgboost
训练代码
param = {'objective': 'multi:softmax', 'num_class':22} param['tree_method'] = 'gpu_hist' bst = xgb.train(param, dtrain, 50, verbose_eval=True, evals=eval_set)
错误信息
XGBoostError: [11:16:53] C:/buildkite-agent/builds/buildkite-windows-cpu-autoscaling-group-i-0ac76685cf763591d-1/xgboost/xgboost-ci-windows/src/gbm/gbtree.cc:611: Check failed: common::AllVisibleGPUs() >= 1 (0 vs. 1) : No visible GPU is found for XGBoost.
问题原因与解决办法
- Intel集成GPU的支持限制:XGBoost原生的
gpu_hist后端仅支持NVIDIA CUDA GPU,Intel Iris Xe这类集成GPU不在其适配范围内——这就是你在Colab(使用NVIDIA GPU)能正常运行、本地却报错的核心原因。 - 适配Intel GPU的方案:
- 卸载现有XGBoost:
pip uninstall -y xgboost - 安装Intel优化版本:
pip install xgboost-intel - 修改代码参数,将
tree_method改为hist(该后端会自动调用Intel oneAPI加速集成GPU,无需指定gpu_hist):param = {'objective': 'multi:softmax', 'num_class':22} param['tree_method'] = 'hist' bst = xgb.train(param, dtrain, 50, verbose_eval=True, evals=eval_set)
- 卸载现有XGBoost:
- 替代方案:如果必须使用原生XGBoost的
gpu_hist加速,只能更换为NVIDIA独立GPU,因为该后端仅适配CUDA环境。
内容的提问来源于stack exchange,提问作者Nika Tsereteli
相关产品推荐
相关产品推荐

