File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -20,18 +20,25 @@ ::sycl::device DeviceManager::GetDevice(const DeviceOrd& device_spec) const {
20
20
(collective::IsDistributed ());
21
21
if (not_use_default_selector) {
22
22
DeviceRegister& device_register = GetDevicesRegister ();
23
- const int device_idx =
24
- collective::IsDistributed () ? collective::GetRank () : device_spec.ordinal ;
25
23
if (device_spec.IsSyclDefault ()) {
26
24
auto & devices = device_register.devices ;
25
+ const int device_idx = collective::IsDistributed ()
26
+ ? collective::GetRank () % devices.size ()
27
+ : device_spec.ordinal ;
27
28
CHECK_LT (device_idx, devices.size ());
28
29
return devices[device_idx];
29
30
} else if (device_spec.IsSyclCPU ()) {
30
31
auto & cpu_devices = device_register.cpu_devices ;
32
+ const int device_idx = collective::IsDistributed ()
33
+ ? collective::GetRank () % cpu_devices.size ()
34
+ : device_spec.ordinal ;
31
35
CHECK_LT (device_idx, cpu_devices.size ());
32
36
return cpu_devices[device_idx];
33
37
} else {
34
38
auto & gpu_devices = device_register.gpu_devices ;
39
+ const int device_idx = collective::IsDistributed ()
40
+ ? collective::GetRank () % gpu_devices.size ()
41
+ : device_spec.ordinal ;
35
42
CHECK_LT (device_idx, gpu_devices.size ());
36
43
return gpu_devices[device_idx];
37
44
}
You can’t perform that action at this time.
0 commit comments