code: def main(args):
      print(socket.gethostname(), "Initializing DGL dist")
      dgl.distributed.initialize(args.ip_config)
      if not args.standalone:
          print(socket.gethostname(), "Initializing DGL process group")
          th.distributed.init_process_group(backend=args.backend)
      print(socket.gethostname(), "Initializing DistGraph")
      g = dgl.distributed.DistGraph(
          args.graph_name, part_config=args.part_config
      )
      print(socket.gethostname(), "rank:", g.rank())
  
      pb = g.get_partition_book()
      if "trainer_id" in g.ndata:
          train_nid = dgl.distributed.node_split(
              g.ndata["train_mask"],
              pb,
              force_even=True,
              node_trainer_ids=g.ndata["trainer_id"],
          )
          val_nid = dgl.distributed.node_split(
              g.ndata["val_mask"],
              pb,
              force_even=True,
              node_trainer_ids=g.ndata["trainer_id"],
          )
          test_nid = dgl.distributed.node_split(
              g.ndata["test_mask"],
              pb,
              force_even=True,
              node_trainer_ids=g.ndata["trainer_id"],
          )
      else:
          train_nid = dgl.distributed.node_split(
              g.ndata["train_mask"], pb, force_even=True
          )
          val_nid = dgl.distributed.node_split(
              g.ndata["val_mask"], pb, force_even=True
          )
          test_nid = dgl.distributed.node_split(
              g.ndata["test_mask"], pb, force_even=True
          )
      local_nid = pb.partid2nids(pb.partid).detach().numpy()
      print(
          "part {}, train: {} (local: {}), val: {} (local: {}), test: {} "
          "(local: {})".format(
              g.rank(),
              len(train_nid),
              len(np.intersect1d(train_nid.numpy(), local_nid)),
              len(val_nid),
              len(np.intersect1d(val_nid.numpy(), local_nid)),
              len(test_nid),
              len(np.intersect1d(test_nid.numpy(), local_nid)),
          )
      )
      del local_nid
      if args.num_gpus == -1:
          device = th.device("cpu")
      else:
          dev_id = g.rank() % args.num_gpus
          device = th.device("cuda:" + str(dev_id))
      n_classes = args.n_classes
      if n_classes == 0:
          labels = g.ndata["labels"][np.arange(g.num_nodes())]
          n_classes = len(
              th.unique(labels[th.logical_not(th.isnan(labels))])
          )
          del labels
      print("#labels:", n_classes)
  
      # Pack data
      in_feats = g.ndata["features"].shape[1]
      data = train_nid, val_nid, test_nid, in_feats, n_classes, g
      run(args, device, data)
      print("parent ends")
  
imports: import argparse
  import socket
  import time
  from contextlib import contextmanager
  import dgl
  import dgl.nn.pytorch
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.optim
  import tqdm
label_desc: Use image node_id 5 for calling a global function with example usage: main(args) without return types