Hello, There are 0 to 4 gpu in the server, and one of them or multi-use is intended.
so, I tried to use gpu using os.environ[“CUDA_VISIBLE_DEVICES”]=‘3’ or ‘0, 1, 2, 3’
}. However, torch.cuda.current_device() continues to return 0. Why is it like this?
How do I solve this problem?
thank you
import os
import torch

os.environ["CUDdfA_DEVICE_ORDER"]="PCI_BUS_ID" 
os.environ["CUDA_VISIBLE_DEVICES"]= "3" 
print('Current cuda device:', torch.cuda.current_device())
print('Count of using GPUs:', torch.cuda.device_count())


################print######################
Current cuda device: 0
Count of using GPUs: 1