albanD:

export CUDA_VISIBLE_DEVICES=0,1



After “Run export CUDA_VISIBLE_DEVICES=0,1 on one shell”, both shell nvidia-smi show 8 gpu
Checking torch.cuda.device_count() in both shell, after one of them run Step1, the phenomena as you wish happen: the user that conduct Step1 get the 2 result, while the other get 8.

In short, everything happen as you wish.