ubuntu 16.04 LTS + xgboost 0.7 + GPU support

记录下安装xgboost 踩过的坑,也是为了日后万一再需要,可以翻看。

cpu版的安装倒是很容易的:

$ sudo pip install xgboost

gpu版:

为了避免import的时候把旧版的cpu版的xgboost导入,最好以以下流程安装:

1.卸载旧版xgboost:

$ sudo pip uninstall xgboost

2.git 源码

$ git clone --recursive https://github.com/dmlc/xgboost

3.GPU 配置编译,在xgboost目录下

$ mkdir build  
$ cd build  
$ cmake .. -DUSE_CUDA=ON  
$ make -j  

4 .安装python 库,在xgboost/python-package 目录下

$ sudo python setup.py install 

5.测试GPU支持,在tests/benmark目录下

python benchmark.py --tree_method gpu_hist

成功运行,说明GPU support完成,在其他时候需要使用gpu支持的xgboost时,只需要添加

{'tree_method': 'gpu_hist'}参数即可



猜你喜欢

转载自blog.csdn.net/lccever/article/details/79236378