code: def run(proc_id, nprocs, devices, g, data, mode):
      # find corresponding device for my rank
      device = devices[proc_id]
      torch.cuda.set_device(device)
      # initialize process group and unpack data for sub-processes
      dist.init_process_group(
          backend="nccl",
          init_method="tcp://127.0.0.1:12345",
          world_size=nprocs,
          rank=proc_id,
      )
      num_classes, train_idx, val_idx, test_idx = data
      train_idx = train_idx.to(device)
      val_idx = val_idx.to(device)
      g = g.to(device if mode == "puregpu" else "cpu")
      # create GraphSAGE model (distributed)
      in_size = g.ndata["feat"].shape[1]
      model = SAGE(in_size, 256, num_classes).to(device)
      model = DistributedDataParallel(
          model, device_ids=[device], output_device=device
      )
      # training + testing
      use_uva = mode == "mixed"
      train(
          proc_id,
          nprocs,
          device,
          g,
          num_classes,
          train_idx,
          val_idx,
          model,
          use_uva,
      )
      layerwise_infer(
          proc_id, device, g, num_classes, test_idx, model, use_uva
      )
      # cleanup process group
      dist.destroy_process_group()
  
imports: import argparse
  import os
  import dgl.nn
  import torch
  import torch.distributed
  import torch.multiprocessing
  import torch.nn
  import torch.nn.functional
  import torchmetrics.functional
  import tqdm
  from dgl.data import AsNodePredDataset
  from dgl.dataloading import DataLoader, MultiLayerFullNeighborSampler, NeighborSampler
  from dgl.multiprocessing import shared_tensor
  from ogb.nodeproppred import DglNodePropPredDataset
  from torch.nn.parallel import DistributedDataParallel
label_desc: Use image node_id 4 for calling a global function with example usage: run(proc_id, nprocs, devices, g, data, mode) without return types