Returns a boolean value indicating whether the current device is the first one among its group for `parallel_mode`. Args: parallel_mode: The chosen parallel mode. Returns: bool: a boolean value indicating whether the current device is the first one
(self, parallel_mode: ParallelMode)
| 263 | # return gpc.is_initialized(ParallelMode.SEQUENCE) and gpc.get_world_size(ParallelMode.SEQUENCE) > 1 |
| 264 | |
| 265 | def is_first_rank(self, parallel_mode: ParallelMode): |
| 266 | """Returns a boolean value indicating whether the current device is the first one |
| 267 | among its group for `parallel_mode`. |
| 268 | |
| 269 | Args: |
| 270 | parallel_mode: The chosen parallel mode. |
| 271 | |
| 272 | Returns: |
| 273 | bool: a boolean value indicating whether the current device is the first one |
| 274 | among its group for `parallel_mode`. |
| 275 | """ |
| 276 | rank = 0 |
| 277 | if self.is_initialized(parallel_mode): |
| 278 | rank = self.get_local_rank(parallel_mode) |
| 279 | return rank == 0 |
| 280 | |
| 281 | def is_rank_for_log(self): |
| 282 | """Returns a boolean value indicating whether the current device should print log.""" |
no test coverage detected