os.environ[“CUDA_DEVICE_ORDER”] = “PCI_BUS_ID” os.environ[“CUDA_VISIBLE_DEVICES”] = “0”(os. environ[“CUDA_DEVICE_ORDER”] = “PCI_BUS_ID” os. environ[“CUDA_VISIBLE_DEVICES”] = “0”)

os.environ[“CUDA_DEVICE_ORDER”] = “PCI_BUS_ID” # 按照PCI_BUS_ID顺序从0开始排列GPU设备 os.environ[“CUDA_VISIBLE_DEVICES”] = “0” #设置当前使用的GPU设备仅为0号设备  设备名称为’/gpu:0’os.environ[“CUDA_VISIBLE_DEVICES”] = “1” #设置当前使用的GPU设备仅为1号设备  设备名称为’/gpu:0’os.environ[“CUDA_VISIBLE_DEVICES”] = “0,1” #设置当前使用的GPU设备为0,1号两个设备,名称依次为’/gpu:0’、’/gpu:1’os.environ[“CUDA_VISIBLE_DEVICES”] = “1,0” #设置当前使用的GPU设备为1,0号两个设备,名称依次为’/gpu:0’、’/gpu:1’。表示优先使用1号设备,然后使用0号设备

————————

os. Environ [“cuda_device_order”] = “pci_bus_id” # according to PCI_ BUS_ The ID order starts with 0, and the GPU device OS Environ [“cuda_visible_devices”] = “0” # set the GPU device currently used to be only device 0 “# the device name is’ / GPU: 0’os Environ [“cuda_visible_devices”] = “1” # set the GPU device currently used as only device 1 “# and the device name is’ / GPU: 0’os Environ [“cuda_visible_devices”] = “0,1” # set the GPU devices currently used as two devices 0,1, and the names are ‘/ GPU: 0’, ‘/ GPU: 1’ OS Environ [“cuda_visible_devices”] = “1,0” # set the GPU devices currently used as two devices 1,0, and the names are ‘/ GPU: 0’ and ‘/ GPU: 1’. It means that equipment 1 is used first, and then equipment 0 is used