Issue
I know I can access the current GPU using torch.cuda.current_device()
, but how can I get a list of all the currently available GPUs?
Solution
You can list all the available GPUs by doing:
>>> import torch
>>> available_gpus = [torch.cuda.device(i) for i in range(torch.cuda.device_count())]
>>> available_gpus
[<torch.cuda.device object at 0x7f2585882b50>]
Answered By - vinzee
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.