FinRL
FinRL copied to clipboard
How to use GPU
I have cuda installed. I have given "device": "cuda" in params but I am still getting using cpu device.
A2C_PARAMS = {"n_steps": 5, "ent_coef": 0.01, "learning_rate": 0.0005, "device": "cuda"}
output: {'n_steps': 5, 'ent_coef': 0.01, 'learning_rate': 0.0005, 'device': 'cuda'} Using cpu device Logging to results/a2c
how to use gpu ?
https://github.com/AI4Finance-Foundation/FinRL/issues/1023 Did you check cuda availability of torch itself?
@icsl-Jeon yes I have installed cuda
import torch torch.cuda.is_available()
Output : True
Hello,
I had a similar problem before, I'm not sure if it's the same exact underlying issue, though. Nevertheless, it might help you, so let me share my case. So, I also installed cuda but it didn't work. It turned out that I had multiple pytorch versions installed and it was using the one without GPU support. Maybe it's one thing you could check, if you haven't already. In my case that solved the problem.
Also, maybe running the below could indicate if your problem is similar. In my case it showed the CUDA version, but not the CUDNN. After using the Pythorch version with GPU support, the CUDNN version appeared, and also 'Using cuda device' when running the code for training the agent.
import torch print(f'PyTorch version: {torch.version}') print('*'10) print(f'_CUDA version: ') !nvcc --version print(''*10) print(f'CUDNN version: {torch.backends.cudnn.version()}') print(f'Available GPU devices: {torch.cuda.device_count()}') print(f'Device Name: {torch.cuda.get_device_name()}')
Hope it helps.