How to correctly configure the GPU in the qlib configuration file
❓ Questions and Help
rdagent been talking about GPU-related topics in the chat conversation.
My qlib configuration settings: ` task: .....
GPU: 0
`
(base) ubuntu@PMS:~$ nvcc -V nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2025 NVIDIA Corporation Built on Tue_May_27_02:21:03_PDT_2025 Cuda compilation tools, release 12.9, V12.9.86 Build cuda_12.9.r12.9/compiler.36037853_0
The system has long had CUDA installed. Do I not need to install CUDA myself? Will the code install it automatically? Or do I need to configure something separately?
You should install CUDA version Torch by yourself.
Hi, @kitcoun
Thank you for your attention to RD-Agent. Neither RD-Agent nor Qlib will automatically install CUDA. If your system already has CUDA installed, you don’t need to install it again. However, you do need to make sure that:
- Your PyTorch is the GPU version, not CPU-only;
- PyTorch's CUDA version is compatible with your system's CUDA driver;
- The
GPU: 0in Qlib's configuration just tells it to use the 0th GPU, you need to make sure that GPU is visible on the system.