code: def main(args):
      dgl.distributed.initialize(args.ip_config)
      if not args.standalone:
          th.distributed.init_process_group(backend="gloo")
      g = dgl.distributed.DistGraph(
          args.graph_name, part_config=args.part_config
      )
      print("rank:", g.rank())
      print("number of edges", g.num_edges())
  
      train_eids = dgl.distributed.edge_split(
          th.ones((g.num_edges(),), dtype=th.bool),
          g.get_partition_book(),
          force_even=True,
      )
      train_nids = dgl.distributed.node_split(
          th.ones((g.num_nodes(),), dtype=th.bool),
          g.get_partition_book(),
      )
      global_train_nid = th.LongTensor(
          np.nonzero(g.ndata["train_mask"][np.arange(g.num_nodes())])
      )
      global_valid_nid = th.LongTensor(
          np.nonzero(g.ndata["val_mask"][np.arange(g.num_nodes())])
      )
      global_test_nid = th.LongTensor(
          np.nonzero(g.ndata["test_mask"][np.arange(g.num_nodes())])
      )
      labels = g.ndata["labels"][np.arange(g.num_nodes())]
      if args.num_gpus == -1:
          device = th.device("cpu")
      else:
          dev_id = g.rank() % args.num_gpus
          device = th.device("cuda:" + str(dev_id))
  
      # Pack data
      global_train_nid = global_train_nid.squeeze()
      global_valid_nid = global_valid_nid.squeeze()
      global_test_nid = global_test_nid.squeeze()
      print("number of train {}".format(global_train_nid.shape[0]))
      print("number of valid {}".format(global_valid_nid.shape[0]))
      print("number of test {}".format(global_test_nid.shape[0]))
      data = (
          train_eids,
          train_nids,
          g,
          global_train_nid,
          global_valid_nid,
          global_test_nid,
          labels,
      )
      run(args, device, data)
      print("parent ends")
  
file_path: dgl/examples/pytorch/graphsage/dist/train_dist_unsupervised_transductive.py
imports: import argparse
  import time
  import numpy
  import torch
  import torch.nn.functional
  import torch.optim
  import dgl
  from train_dist_transductive import DistEmb, load_embs
  from train_dist_unsupervised import CrossEntropyLoss, DistSAGE, compute_acc
label_desc: Use image node_id 3 for calling a global function with example usage: main(args) without return types