| 11 | |
| 12 | |
| 13 | class SUPA_Accelerator(DeepSpeedAccelerator): |
| 14 | |
| 15 | def __init__(self): |
| 16 | self._name = 'supa' |
| 17 | # Use BCCL on Linux, fall back to gloo on Windows (no BCCL support yet) |
| 18 | self._communication_backend_name = 'bccl' if sys.platform != 'win32' else 'gloo' |
| 19 | self._compile_backend = "inductor" |
| 20 | |
| 21 | def is_synchronized_device(self): |
| 22 | return False |
| 23 | |
| 24 | def use_host_timers(self): |
| 25 | return self.is_synchronized_device() |
| 26 | |
| 27 | def resolves_data_dependency(self): |
| 28 | return self.is_synchronized_device() |
| 29 | |
| 30 | def handles_memory_backpressure(self): |
| 31 | return self.is_synchronized_device() |
| 32 | |
| 33 | # Device APIs |
| 34 | def device_name(self, device_index=None): |
| 35 | if device_index is None: |
| 36 | return 'supa' |
| 37 | return 'supa:{}'.format(device_index) |
| 38 | |
| 39 | def communication_backend_version(self): |
| 40 | # BCCL does not expose a version via torch.supa |
| 41 | return (0, 0, 0) |
| 42 | |
| 43 | def device(self, device_index=None): |
| 44 | return torch.device('supa', device_index) |
| 45 | |
| 46 | def set_device(self, device_index): |
| 47 | torch.supa.set_device(device_index) |
| 48 | |
| 49 | def current_device(self): |
| 50 | return torch.supa.current_device() |
| 51 | |
| 52 | def current_device_name(self): |
| 53 | return 'supa:{}'.format(torch.supa.current_device()) |
| 54 | |
| 55 | def device_count(self): |
| 56 | return torch.supa.device_count() |
| 57 | |
| 58 | def synchronize(self, device_index=None): |
| 59 | return torch.supa.synchronize(device_index) |
| 60 | |
| 61 | # RNG APIs |
| 62 | def random(self): |
| 63 | return torch.random |
| 64 | |
| 65 | def set_rng_state(self, new_state, device_index=None): |
| 66 | if device_index is None: |
| 67 | return torch.supa.set_rng_state(new_state) |
| 68 | return torch.supa.set_rng_state(new_state, device_index) |
| 69 | |
| 70 | def get_rng_state(self, device_index=None): |
no outgoing calls
no test coverage detected
searching dependent graphs…