I’ve 3 gpus system in my university and i’m allowed to use 3rd gpu. In pytorch, I can specify it with torch.device(‘cuda:2’). How to do the same with fastai. Fastai automatically put code on cuda:0.
It worked! Thanks!
torch.cuda.set_device('cuda:2')
1 Like
after we
torch.cuda.set_device('cuda:1')
when we construct a learner with dls as arguments,
we also have to
dls.device = default_device()
Including this line at the beginning of my code (according to the fastai documentation) worked for me:
import os; os.environ['CUDA_VISIBLE_DEVICES']='2'