ShiLiang Zhang
2023-08-07 9d7c6e75f0b2ab1a5fc6e3a3a795d804fdb0bc8d
1
2
3
4
5
6
7
8
9
10
11
12
import sys
import torch.distributed
import logging
 
HINTED = set()
 
 
def hint_once(content, uid, rank=None):
    if (rank is None) or (not torch.distributed.is_initialized()) or torch.distributed.get_rank() == rank:
        if uid not in HINTED:
            logging.info(content)
            HINTED.add(uid)