code: def get_shuffle_global_nids(
      rank, world_size, global_nids_ranks, node_data
  ):
      """
      For nodes which are not owned by the current rank, whose global_nid <-> shuffle_global-nid mapping
      is not present at the current rank, this function retrieves their shuffle_global_ids from the owner rank
  
      Parameters:
      -----------
      rank : integer
          rank of the process
      world_size : integer
          total no. of ranks configured
      global_nids_ranks : list
          list of numpy arrays (of global_nids), index of the list is the rank of the process
                      where global_nid <-> shuffle_global_nid mapping is located.
      node_data : dictionary
          node_data is a dictionary with keys as column names and values as numpy arrays
  
      Returns:
      --------
      numpy ndarray
          where the column-0 are global_nids and column-1 are shuffle_global_nids which are retrieved
          from other processes.
      """
      # build a list of sizes (lengths of lists)
      global_nids_ranks = [
          torch.from_numpy(x) for x in global_nids_ranks
      ]
      recv_nodes = alltoallv_cpu(rank, world_size, global_nids_ranks)
  
      # Use node_data to lookup global id to send over.
      send_nodes = []
      for proc_i_nodes in recv_nodes:
          # list of node-ids to lookup
          if proc_i_nodes is not None:
              global_nids = proc_i_nodes.numpy()
              if len(global_nids) != 0:
                  common, ind1, ind2 = np.intersect1d(
                      node_data[constants.GLOBAL_NID],
                      global_nids,
                      return_indices=True,
                  )
                  shuffle_global_nids = node_data[
                      constants.SHUFFLE_GLOBAL_NID
                  ][ind1]
                  send_nodes.append(
                      torch.from_numpy(shuffle_global_nids).type(
                          dtype=torch.int64
                      )
                  )
              else:
                  send_nodes.append(torch.empty((0), dtype=torch.int64))
          else:
              send_nodes.append(torch.empty((0), dtype=torch.int64))
  
      # send receive global-ids
      recv_shuffle_global_nids = alltoallv_cpu(
          rank, world_size, send_nodes
      )
      shuffle_global_nids = np.concatenate(
          [
              x.numpy() if x is not None else []
              for x in recv_shuffle_global_nids
          ]
      )
      global_nids = np.concatenate([x for x in global_nids_ranks])
      ret_val = np.column_stack([global_nids, shuffle_global_nids])
      return ret_val
  
file_path: dgl/tools/distpartitioning/globalids.py
imports: import itertools
  import operator
  import constants
  import numpy
  import torch
  from dist_lookup import DistLookupService
  from gloo_wrapper import allgather_sizes, alltoallv_cpu
  from utils import memory_snapshot
label_desc: Use image node_id 1 for calling a global function with example usage: get_shuffle_global_nids(rank, world_size, global_nids_ranks, node_data) and returns: ret_val