Just specify the available GPUs in the script of running.
CUDA_VISIBLE_DEVICES=2, 4, 5, 7 python -m train When GPU 2, 4, 5, 7 are selected, they are labeled as 0, 1, 2, 3 in the program.