环境:
- ubuntu18.04(64bits)
- CUDA:10.1
- Python3: 3.6.9
scikit-learn提供 了基于svm的相关函数,用于处理分类与回归任务;xgboost、lightgbm、catboost等库提供了GBDT,决策树、随机森林等相关函数,但这些都有个问题:面对大数据集时模型训练非常慢。最近因为需要找到了利用GPU加速计算的svm和gbm库:thundersvm和thundergbm,地址在:
https://github.com/Xtra-Computing/thundersvm
https://github.com/Xtra-Computing/thundergbm
笔者的环境是CUDA10.1,官方文档上只介绍了Linux CUDA9.0和Windows CUDA10的安装情况,当然还有源码安装情况,几个笔者亲自测试,使用源码安装也是可以使用CUDA10.1编译源文件最终实现GPU加速的。
源码安装教程如下(使用python接口):
-
thundersvm
- 首先下载源码:
git clone https://github.com/Xtra-Computing/thundersvm.git
- 编译:
cd thundersvm mkdir build && cd build && cmake .. && make -j
- 进入python文件就路径安装:
cd ../python sudo python3 setup.py install
- 安装完成后打开ipython导入thundersvm进行测试:
from thundersvm import * SVC?
- 首先下载源码:
-
thundergbm
thundergbm源码安装的步骤和thundersvm差不多,需要注意的是源码下载还需要多一个步骤:
git clone https://github.com/zeyiwen/thundergbm.git
cd thundergbm
#under the directory of thundergbm
git submodule init cub && git submodule update
编译完成之后进入python目录执行sudo python3 setup.py install
进行安装。
经笔者测试(只测试了SVC分类函数),GPU可以有效加速计算。