code: def memory_snapshot(tag, rank):
      """
      Utility function to take a snapshot of the usage of system resources
      at a given point of time.
  
      Parameters:
      -----------
      tag : string
          string provided by the user for bookmarking purposes
      rank : integer
          process id of the participating process
      """
      GB = 1024 * 1024 * 1024
      MB = 1024 * 1024
      KB = 1024
  
      peak = dgl.partition.get_peak_mem() * KB
      mem = psutil.virtual_memory()
      avail = mem.available / MB
      used = mem.used / MB
      total = mem.total / MB
  
      mem_string = f"{total:.0f} (MB) total, {peak:.0f} (MB) peak, {used:.0f} (MB) used, {avail:.0f} (MB) avail"
      logging.debug(
          f"[Rank: {rank} MEMORY_SNAPSHOT] {mem_string} - {tag}"
      )
  
imports: import json
  import logging
  import os
  from itertools import cycle
  import constants
  import dgl
  import numpy
  import psutil
  import pyarrow
  import torch
  from dgl.distributed.partition import _dump_part_config
  from pyarrow import csv
label_desc: Use image node_id 20 for calling a global function with example usage: memory_snapshot(tag, rank) without return types