How to use Multiple GPUs?

Wondering how to set fastai to use a different GPU (if you have more than one)?
use:
os.environ[‘CUDA_VISIBLE_DEVICES’] = ‘n’ in your notebook
where n is the number (starting with zero for the first one)

this must be done BEFORE you import the fastai library.

e.g.
import os
os.environ[‘CUDA_VISIBLE_DEVICES’] = '1’
from fastai.conv_learner import *

2 Likes