| 13 | |
| 14 | |
| 15 | class MLU_Accelerator(DeepSpeedAccelerator): |
| 16 | |
| 17 | def __init__(self): |
| 18 | self._name = 'mlu' |
| 19 | self._communication_backend_name = 'cncl' |
| 20 | self._compile_backend = "inductor" |
| 21 | self.class_dict = None |
| 22 | |
| 23 | def is_synchronized_device(self): |
| 24 | return False |
| 25 | |
| 26 | def use_host_timers(self): |
| 27 | return self.is_synchronized_device() |
| 28 | |
| 29 | def resolves_data_dependency(self): |
| 30 | return self.is_synchronized_device() |
| 31 | |
| 32 | def handles_memory_backpressure(self): |
| 33 | return self.is_synchronized_device() |
| 34 | |
| 35 | # Device APIs |
| 36 | def device_name(self, device_index=None): |
| 37 | if device_index == None: |
| 38 | return 'mlu' |
| 39 | return 'mlu:{}'.format(device_index) |
| 40 | |
| 41 | def device(self, device_index=None): |
| 42 | return torch.mlu.device(device_index) |
| 43 | |
| 44 | def set_device(self, device_index): |
| 45 | torch.mlu.set_device(device_index) |
| 46 | |
| 47 | def current_device(self): |
| 48 | return torch.mlu.current_device() |
| 49 | |
| 50 | def current_device_name(self): |
| 51 | return 'mlu:{}'.format(torch.mlu.current_device()) |
| 52 | |
| 53 | def device_count(self): |
| 54 | return torch.mlu.device_count() |
| 55 | |
| 56 | def synchronize(self, device_index=None): |
| 57 | return torch.mlu.synchronize(device_index) |
| 58 | |
| 59 | # RNG APIs |
| 60 | def random(self): |
| 61 | return torch.random |
| 62 | |
| 63 | def set_rng_state(self, new_state, device_index=None): |
| 64 | if device_index is None: |
| 65 | return torch.mlu.set_rng_state(new_state) |
| 66 | |
| 67 | return torch.mlu.set_rng_state(new_state, device_index) |
| 68 | |
| 69 | def get_rng_state(self, device_index=None): |
| 70 | if device_index is None: |
| 71 | return torch.mlu.get_rng_state() |
| 72 |
no outgoing calls
no test coverage detected
searching dependent graphs…