已合并
[sync] PR-40339: modify _dynamo_device.py for benchmarks multi process set device error #40448
ascend-robot创建于 7月8日
[sync] PR-40339: modify _dynamo_device.py for benchmarks multi process set device error #40448
已合并
共 1 个文件变更+2-1
| @@ -72,7 +72,8 @@ class NpuInterface(DeviceInterface): | |||
| 72 | 72 | ||
| 73 | def exchange_device(device: int) -> int: | 73 | def exchange_device(device: int) -> int: |
| 74 | curr_device = current_device() | 74 | curr_device = current_device() |
| 75 | - set_device(device) | 75 | + if curr_device != device: |
| 76 | + set_device(device) | ||
| 76 | return curr_device | 77 | return curr_device |
| 77 | 78 | ||
| 78 | 79 | ||