@@ -22,7 +22,7 @@ def all_reduce_test_worker(tp_size: int, pp_size: int, rank: int,
22
22
# it is important to delete the CUDA_VISIBLE_DEVICES environment variable
23
23
# so that each worker can see all the GPUs
24
24
# they will be able to set the device to the correct GPU
25
- del os .environ [ "CUDA_VISIBLE_DEVICES" ]
25
+ os .environ . pop ( "CUDA_VISIBLE_DEVICES" , None )
26
26
device = torch .device (f"cuda:{ rank } " )
27
27
torch .cuda .set_device (device )
28
28
init_test_distributed_environment (tp_size , pp_size , rank ,
@@ -44,7 +44,7 @@ def all_gather_test_worker(tp_size: int, pp_size: int, rank: int,
44
44
# it is important to delete the CUDA_VISIBLE_DEVICES environment variable
45
45
# so that each worker can see all the GPUs
46
46
# they will be able to set the device to the correct GPU
47
- del os .environ [ "CUDA_VISIBLE_DEVICES" ]
47
+ os .environ . pop ( "CUDA_VISIBLE_DEVICES" , None )
48
48
device = torch .device (f"cuda:{ rank } " )
49
49
torch .cuda .set_device (device )
50
50
init_test_distributed_environment (tp_size , pp_size , rank ,
@@ -72,7 +72,7 @@ def broadcast_tensor_dict_test_worker(tp_size: int, pp_size: int, rank: int,
72
72
# it is important to delete the CUDA_VISIBLE_DEVICES environment variable
73
73
# so that each worker can see all the GPUs
74
74
# they will be able to set the device to the correct GPU
75
- del os .environ [ "CUDA_VISIBLE_DEVICES" ]
75
+ os .environ . pop ( "CUDA_VISIBLE_DEVICES" , None )
76
76
device = torch .device (f"cuda:{ rank } " )
77
77
torch .cuda .set_device (device )
78
78
init_test_distributed_environment (tp_size , pp_size , rank ,
@@ -108,7 +108,7 @@ def broadcast_tensor_dict_test_worker(tp_size: int, pp_size: int, rank: int,
108
108
@ray .remote (num_gpus = 1 , max_calls = 1 )
109
109
def send_recv_tensor_dict_test_worker (tp_size : int , pp_size : int , rank : int ,
110
110
distributed_init_port : str ):
111
- del os .environ [ "CUDA_VISIBLE_DEVICES" ]
111
+ os .environ . pop ( "CUDA_VISIBLE_DEVICES" , None )
112
112
device = torch .device (f"cuda:{ rank } " )
113
113
torch .cuda .set_device (device )
114
114
init_test_distributed_environment (tp_size , pp_size , rank ,
@@ -148,7 +148,7 @@ def send_recv_tensor_dict_test_worker(tp_size: int, pp_size: int, rank: int,
148
148
@ray .remote (num_gpus = 1 , max_calls = 1 )
149
149
def send_recv_test_worker (tp_size : int , pp_size : int , rank : int ,
150
150
distributed_init_port : str ):
151
- del os .environ [ "CUDA_VISIBLE_DEVICES" ]
151
+ os .environ . pop ( "CUDA_VISIBLE_DEVICES" , None )
152
152
device = torch .device (f"cuda:{ rank } " )
153
153
torch .cuda .set_device (device )
154
154
init_test_distributed_environment (tp_size , pp_size , rank ,
0 commit comments