code: def parse_test_arguments(supports_distributed):
      parser = argparse.ArgumentParser(
          description="Compare external source vs filereader performance in RN50 data pipeline case"
      )
      parser.add_argument(
          "data_path",
          type=str,
          help="Directory path of training dataset",
      )
      parser.add_argument(
          "-b",
          "--batch_size",
          default=1024,
          type=int,
          metavar="N",
          help="batch size",
      )
      parser.add_argument(
          "-j",
          "--workers",
          default=3,
          type=int,
          metavar="N",
          help="number of data loading workers (default: 3)",
      )
      parser.add_argument(
          "--py_workers",
          default=3,
          type=int,
          metavar="N",
          help="number of python external source workers (default: 3)",
      )
      parser.add_argument(
          "--epochs",
          default=2,
          type=int,
          metavar="N",
          help="Number of epochs to run",
      )
      parser.add_argument(
          "--benchmark_iters",
          type=int,
          metavar="N",
          help="Number of iterations to run in each epoch",
      )
      parser.add_argument(
          "--worker_init",
          default="fork",
          choices=["fork", "spawn"],
          type=str,
          help="Python workers initialization method",
      )
      parser.add_argument(
          "--prefetch",
          default=2,
          type=int,
          metavar="N",
          help="Pipeline cpu/gpu prefetch queue depth",
      )
      parser.add_argument(
          "--reader_queue_depth",
          default=1,
          type=int,
          metavar="N",
          help="Depth of prefetching queue for file reading operators "
          "(FileReader/parallel ExternalSource)",
      )
      parser.add_argument(
          "--test_pipes",
          nargs="+",
          default=["parallel", "file_reader", "scalar"],
          help="Pipelines to be tested, allowed values: 'parallel', 'file_reader', 'scalar'",
      )
      parser.add_argument(
          "--source_mode",
          default="sample",
          choices=["sample", "batch", "generator"],
          type=str,
          help="Available modes: sample, batch, generator. First two run stateless "
          "callbacks that return sample or batch given the index, the "
          "generator mode iterates over a generator. "
          "Parameter value has no effect on file reader pipeline.",
      )
      parser.add_argument(
          "--dali_decode",
          default=False,
          type=bool,
          help="If True decodes images with DALI's mixed decoder, otherwise decodes "
          "on cpu (inside external source callback if applicable) and moves "
          "with tensor.gpu()",
      )
  
      if not supports_distributed:
          parser.add_argument(
              "-g",
              "--gpus",
              default=1,
              type=int,
              metavar="N",
              help="number of GPUs",
          )
      args = parser.parse_args()
  
      if "WORLD_SIZE" in os.environ:
          args.distributed = int(os.environ["WORLD_SIZE"]) > 1
      if "LOCAL_RANK" in os.environ:
          args.local_rank = int(os.environ["LOCAL_RANK"])
      else:
          args.local_rank = 0
  
      if supports_distributed:
          print(
              "GPU ID: {}, batch: {}, epochs: {}, workers: {}, py_workers: {}, prefetch depth: {}, "
              "reader_queue_depth: {}, worker_init: {}, test_pipes: {}".format(
                  args.local_rank,
                  args.batch_size,
                  args.epochs,
                  args.workers,
                  args.py_workers,
                  args.prefetch,
                  args.reader_queue_depth,
                  args.worker_init,
                  args.test_pipes,
              )
          )
      else:
          print(
              "GPUS: {}, batch: {}, epochs: {}, workers: {}, py_workers: {}, prefetch depth: {}, "
              "reader_queue_depth: {}, worker_init: {}, test_pipes: {}".format(
                  args.gpus,
                  args.batch_size,
                  args.epochs,
                  args.workers,
                  args.py_workers,
                  args.prefetch,
                  args.reader_queue_depth,
                  args.worker_init,
                  args.test_pipes,
              )
          )
  
      return args
  
imports: import argparse
  import cv2
  import numpy
  import nvidia.dali
  import nvidia.dali.types
  import os
label_desc: Use image node_id 7 for calling a global function with example usage: parse_test_arguments(supports_distributed) and returns: args