Can not assign gpu id, help?

I tried to assign my multi gpus with :
CUDA_VISIBLE_DIVICES=2 python train.py ,
but why pytorch is always using the first gpu?

torch.cuda.set_device(gpu_id) # gpu_id is an integer corresponding to your GPU ID

1 Like