code: def main() -> None:
      parser = init_argparse()
      args = parser.parse_args()
  
      datetime_sfx: str = time.strftime("%Y%m%dT%H%M%S")
  
      warmup_iters: int = args.warmup_iters
      bench_iters: int = args.bench_iters
      prof_iters: int = args.prof_iters
      num_inputs_to_gen: int = warmup_iters + bench_iters + prof_iters
  
      world_size: int = args.world_size
      batch_size: int = args.batch_size
  
      output_dir: str = args.output_dir
  
      num_benchmarks = args.num_benchmarks
  
      if not os.path.exists(output_dir):
          # Create output directory if not exist
          os.mkdir(output_dir)
  
      output_dir += f"/run_{datetime_sfx}"
      if not os.path.exists(output_dir):
          # Place all outputs under the datetime folder
          os.mkdir(output_dir)
  
      BENCH_SHARDING_TYPES = [
          ShardingType.TABLE_WISE,
          ShardingType.ROW_WISE,
          ShardingType.COLUMN_WISE,
      ]
  
      table_sizes = [
          (40_000_000, 256),
          (4_000_000, 256),
          (1_000_000, 256),
      ]
  
      tables, inputs = get_tables_and_input(
          table_sizes, num_inputs_to_gen, batch_size, world_size
      )
      print_device_memory_allocated_status(
          "Memory After Generating Inputs"
      )
  
      warmup_inputs = inputs[:warmup_iters]
      bench_inputs = inputs[warmup_iters : (warmup_iters + bench_iters)]
      prof_inputs = inputs[-prof_iters:]
  
      tables_info = "\nTABLE SIZES QUANT:"
      for i, (num, dim) in enumerate(table_sizes):
          mb = int(float(num * dim) / 1024 / 1024)
          tables_info += f"\nTABLE[{i}][{num:9}, {dim:4}] u8: {mb:6}Mb"
  
      report: str = f"REPORT BENCHMARK {datetime_sfx} world_size:{world_size} batch_size:{batch_size//1000}k\n"
      report += tables_info
      report += "\n"
  
      benchmark_results: List[BenchmarkResult] = []
  
      # enable_reference_cycle_detector()
  
      # TEST UNSHARDED
      for terminal_stage in UNSHARDED_TERMINAL_STAGES:
          benchmark_type = benchmark_type_name(
              terminal_stage, ShardingType.TABLE_WISE
          )
          logging.info(
              f"\n\n###### Running QEBC Benchmark Type: {benchmark_type} ######\n"
          )
  
          res = run_benchmark(
              terminal_stage=terminal_stage,
              tables=tables,
              quant_device=torch.device("cuda:0"),
              device=torch.device("cuda:0"),
              sharding_type=ShardingType.TABLE_WISE,
              world_size=world_size,
              batch_size=batch_size,
              warmup_inputs=warmup_inputs,
              bench_inputs=bench_inputs,
              prof_inputs=prof_inputs,
              output_dir=output_dir,
              num_benchmarks=num_benchmarks,
          )
  
          # Reference cycles present with torch.fx.GraphModule
          gc.collect()
          benchmark_results.append(res)
          print_device_memory_allocated_status(
              "Memory Post Benchmarking"
          )
  
      # TEST SHARDED
      for sharding_type in BENCH_SHARDING_TYPES:
          for terminal_stage in SHARDED_TERMINAL_STAGES:
              benchmark_type = benchmark_type_name(
                  terminal_stage, sharding_type
              )
              logging.info(
                  f"\n\n###### Running QEBC Benchmark Type: {benchmark_type} ######\n"
              )
              res = run_benchmark(
                  terminal_stage=terminal_stage,
                  tables=tables,
                  quant_device=torch.device("cpu"),
                  device=torch.device("cuda:0"),
                  sharding_type=sharding_type,
                  world_size=world_size,
                  batch_size=batch_size,
                  warmup_inputs=warmup_inputs,
                  bench_inputs=bench_inputs,
                  prof_inputs=prof_inputs,
                  output_dir=output_dir,
                  num_benchmarks=num_benchmarks,
              )
  
              gc.collect()
              benchmark_results.append(res)
              print_device_memory_allocated_status(
                  "Memory Post Benchmarking"
              )
  
      num_requests = len(bench_inputs) * batch_size * num_benchmarks
      report += f"num_requests:{num_requests:8}\n"
  
      report_file: str = f"{output_dir}/run.report"
  
      write_report(benchmark_results, report_file, report, num_requests)
  
imports: import argparse
  import gc
  import logging
  import os
  import time
  from dataclasses import dataclass
  from enum import Enum
  from typing import Dict, List, Tuple
  import torch
  from torch.autograd.profiler import record_function
  from torchrec.distributed.embedding_types import EmbeddingComputeKernel, ShardingType
  from torchrec.distributed.planner import EmbeddingShardingPlanner, Topology
  from torchrec.distributed.planner.enumerators import EmbeddingEnumerator
  from torchrec.distributed.planner.shard_estimators import EmbeddingPerfEstimator, EmbeddingStorageEstimator
  from torchrec.distributed.shard import _shard_modules
  from torchrec.distributed.test_utils.infer_utils import TestQuantEBCSharder
  from torchrec.distributed.test_utils.test_model import ModelInput
  from torchrec.distributed.types import DataType, ShardingEnv
  from torchrec.fx import symbolic_trace
  from torchrec.modules.embedding_configs import EmbeddingBagConfig
  from torchrec.quant.embedding_modules import EmbeddingBagCollection
  from torchrec.sparse.jagged_tensor import KeyedJaggedTensor, KeyedTensor
label_desc: Use image node_id 9 for calling a global function with example usage: main() without return types