(self, rank, world_size)
Due to some issues with `torch.distributed.barrier()`, we have to
        implement this ugly barrier function.
Due to some issues with `torch.distributed.barrier()`, we have to
        implement this ugly barrier function.
Due to some issues with torch . distributed . barrier () we have to implement this ugly barrier function .
def _barrier(self, rank, world_size):
        """Due to some issues with `torch.distributed.barrier()`, we have to
        implement this ugly barrier function.
        """
        if rank == 0:
            for i in range(1, world_size):
                tmp = osp.join(self.lock_dir, '{}.pkl'.format(i))
                while not (osp.exists(tmp)):
                    time.sleep(1)
            for i in range(1, world_size):
                tmp = osp.join(self.lock_dir, '{}.pkl'.format(i))
                os.remove(tmp)
        else:
            tmp = osp.join(self.lock_dir, '{}.pkl'.format(rank))
            mmcv.dump([], tmp)
            while osp.exists(tmp):
                time.sleep(1)
def _barrier ( self , rank , world_size ) : if rank == 0 : for i in range ( 1 , world_size ) : tmp = osp . join ( self . lock_dir , '{}.pkl' . format ( i ) ) while not ( osp . exists ( tmp ) ) : time . sleep ( 1 ) for i in range ( 1 , world_size ) : tmp = osp . join ( self . lock_dir , '{}.pkl' . format ( i ) ) os . remove ( tmp ) else : tmp = osp . join ( self . lock_dir , '{}.pkl' . format ( rank ) ) mmcv . dump ( [ ] , tmp ) while osp . exists ( tmp ) : time . sleep ( 1 )