Returns: The rank of the current process within the local (per-machine) process group.
()
| 65 | |
| 66 | |
| 67 | def get_local_rank() -> int: |
| 68 | """ |
| 69 | Returns: |
| 70 | The rank of the current process within the local (per-machine) process group. |
| 71 | """ |
| 72 | if not dist.is_available(): |
| 73 | return 0 |
| 74 | if not dist.is_initialized(): |
| 75 | return 0 |
| 76 | assert _LOCAL_PROCESS_GROUP is not None |
| 77 | return dist.get_rank(group=_LOCAL_PROCESS_GROUP) |
| 78 | |
| 79 | |
| 80 | def get_local_size() -> int: |
nothing calls this directly
no outgoing calls
no test coverage detected