Returns: The size of the per-machine process group, i.e. the number of processes per machine.
()
| 78 | |
| 79 | |
| 80 | def get_local_size() -> int: |
| 81 | """ |
| 82 | Returns: |
| 83 | The size of the per-machine process group, i.e. the number of processes per machine. |
| 84 | """ |
| 85 | if not dist.is_available(): |
| 86 | return 1 |
| 87 | if not dist.is_initialized(): |
| 88 | return 1 |
| 89 | return dist.get_world_size(group=_LOCAL_PROCESS_GROUP) |
| 90 | |
| 91 | |
| 92 | def is_main_process() -> bool: |
nothing calls this directly
no outgoing calls
no test coverage detected