Initialize the process group for the ranks. This global group can be easily destroyed by calling dist.destroy_process_group. Args: master_port: The specified port of the master node. If not set, will use _get_master_port to get the port. timeout: The timeout
(
self,
*,
timeout: timedelta = timedelta(minutes=10),
)
| 500 | ) |
| 501 | |
| 502 | def init_process_group( |
| 503 | self, |
| 504 | *, |
| 505 | timeout: timedelta = timedelta(minutes=10), |
| 506 | ): |
| 507 | """ |
| 508 | Initialize the process group for the ranks. This global group can be easily destroyed by calling dist.destroy_process_group. |
| 509 | |
| 510 | Args: |
| 511 | master_port: The specified port of the master node. If not set, will use _get_master_port to get the port. |
| 512 | timeout: The timeout of the process group. |
| 513 | """ |
| 514 | self._store_counter += 1 |
| 515 | sub_store = torch.distributed.PrefixStore(f"prefix-{self._store_counter}", self._store) |
| 516 | dist.init_process_group( |
| 517 | backend=self.device_manager.backend, |
| 518 | world_size=self._world_size, |
| 519 | rank=self._rank, |
| 520 | timeout=timeout, |
| 521 | store=sub_store, |
| 522 | ) |
| 523 | logger.info(f"[rank{self._rank}] init process group successfully.") |
| 524 | |
| 525 | def store_based_barrier(self, timeout: timedelta = timedelta(minutes=5)) -> None: |
| 526 | """ |
no outgoing calls
no test coverage detected