🐍 Python & library/Scikit-Learn

XGBoost GPU 로 가속하기

복만 2022. 4. 13. 14:28

출처: https://xgboost.readthedocs.io/en/stable/gpu/index.html

 

XGBoost GPU Support — xgboost 1.5.2 documentation

XGBoost GPU Support This page contains information about GPU algorithms supported in XGBoost. Note CUDA 10.0, Compute Capability 3.5 required The GPU algorithms in XGBoost require a graphics card with compute capability 3.5 or higher, with CUDA toolkits 10

xgboost.readthedocs.io

 

CUDA 10.0 이상의 버전이 설치되어 있으면 GPU로 XGBoost를 가속할 수 있다.

 

방법은 다음과 같다.

모델에 다음과 같이 tree_methodgpu_id parameter를 추가해 주면 된다.

XGBRegressor(tree_method='gpu_hist', gpu_id=0)

 

gpu_id는 사용할 gpu의 번호로, nvidia-smi를 이용해 확인할 수 있다.

반응형