A function that returns the local Horovod rank of the calling process, within the node that it is running on. For example, if there are seven processes running on a node, their local ranks will be zero through six, inclusive. Returns: An integer scalar with the loc
(self)
| 236 | return rank |
| 237 | |
| 238 | def local_rank(self): |
| 239 | """A function that returns the local Horovod rank of the calling process, within the |
| 240 | node that it is running on. For example, if there are seven processes running |
| 241 | on a node, their local ranks will be zero through six, inclusive. |
| 242 | |
| 243 | Returns: |
| 244 | An integer scalar with the local Horovod rank of the calling process. |
| 245 | """ |
| 246 | local_rank = self.MPI_LIB_CTYPES.horovod_local_rank() |
| 247 | if local_rank == -1: |
| 248 | raise ValueError( |
| 249 | 'Horovod has not been initialized; use hvd.init().') |
| 250 | return local_rank |
| 251 | |
| 252 | def cross_rank(self): |
| 253 | """A function that returns the cross Horovod rank of the calling process, across the |
no outgoing calls