简体   繁体   English

python中XGBoost如何选择GPU设备

[英]How to choose GPU device for XGBoost in python

I'm running XGBoost (eXtreme Gradient Boosting) in Python on a shared linux server, which is equipped with multiple GPUs.我在 Python 的共享服务器 linux 上运行 XGBoost(eXtreme Gradient Boosting),该服务器配备了多个 GPU。 When I run XGBoost on a GPU, XGBoost automatically selects GPU device 0. Does anybody know how I can make XGBoost to select another GPU?当我在 GPU 上运行 XGBoost 时,XGBoost 会自动选择 GPU 设备 0。有人知道我如何使 XGBoost 成为 select 另一个 GPU 吗? (gpu0 is normally too busy ) (gpu0 通常太忙了)

Looking into the source code, it turned out that it can be chosen in the constructor of the class by assigning the gpu device number to gpu_id .查看源代码,原来可以通过将 gpu 设备号分配给gpu_id来在 class 的构造函数中选择它。 Eg,例如,

xgb.XGBClassifier(tree_method='gpu_hist',predictor='gpu_predictor',gpu_id=1)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM