code: def rank0_first(func, *args, **kwargs):
      "Execute `func` in the Rank-0 process first, then in other ranks in parallel."
      if args or kwargs:
          func = partial(func, *args, **kwargs)
      dummy_l = Learner(
          DataLoaders(device="cpu"),
          nn.Linear(1, 1),
          loss_func=lambda: 0,
      )
      with dummy_l.distrib_ctx():
          if not rank_distrib():
              res = func()
          distrib_barrier()
          if rank_distrib():
              res = func()
      return res
  
imports: from __future__ import annotations
  from .basics import *
  from .callback.progress import ProgressCallback
  from torch.nn.parallel import DistributedDataParallel, DataParallel
  from .data.load import _FakeLoader, _loaders
  from .optimizer import OptimWrapper
label_desc: Use image node_id 12 for calling a global function with example usage: rank0_first(func) and returns: res