XGBoost using GPU in wsl environment doesnt work

Hello everyone!
Here is the description of my problem:
I am running the program in a wsl environment.
I set the device: cuda and tree_method: hist in my xgRegressor parameter list;
and I use Gridsearch to select the best hyperparameters.

But my GPU acceleration does not work, and the training process does not start, either.

My cuda infomation is as following:
nvcc: NVIDIA ® Cuda compiler driver
Copyright © 2005-2019 NVIDIA Corporation
Built on Sun_Jul_28_19:07:16_PDT_2019
Cuda compilation tools, release 10.1, V10.1.243

Latest XGBoost requires CUDA version 11.0 or later. Would you be able to upgrade CUDA?

Thanks, I will try your suggestion first.

Hi Philip,

I upgraded my cuda version to 11.6 as following:
nvcc -V
nvcc: NVIDIA ® Cuda compiler driver
Copyright © 2005-2021 NVIDIA Corporation
Built on Fri_Dec_17_18:16:03_PST_2021
Cuda compilation tools, release 11.6, V11.6.55
Build cuda_11.6.r11.6/compiler.30794723_0

but my xgregressor model could not run on gpu yet…

This time I run dmesg and I saw the following error:
misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22

and I tried to complie an example under cuda_samples folder to make sure that my GPU driver and cuda work:

Do you have any other ideas regarding this…?

I have no idea. I was able to run XGBoost with GPU in WSL2 myself

Hi Philip,

Good to know you were able to make this work in wsl2!
Could you please tell me more about your environment configuration?
Such as your XGBoost version? Python version? GPU type? Nvidia Driver version? Cuda version…
I will appreciate your information very much!



XGBoost version: 2.0.3, installed using pip install xgboost
Python version: 3.10
GPU: NVIDIA GeForce RTX 3060 Ti
CUDA: CUDA 12.4, WSL-Ubuntu, installed via deb (network)

Hope it helps!

1 Like

Hi Philip,

I finally figured it out why it did not work. It was probably because I set “device=cuda” and “gpu_id=0” simultaneously. And it worked now!

Thanks so much!