code: def run(args):
      results_fn = get_fn("result", args, base=RESULT_DIR) + ".txt"
  
      index_params = [(12, 100)]
      query_params = args.ef_searches or [
          25,
          50,
          100,
          250,
          500,
          750,
          1000,
          1500,
          2500,
          5000,
      ]
      if args.build_only:
          query_params = query_params[:1]
  
      algos = {
          "n2": [
              N2(
                  M,
                  ef_con,
                  args.n_threads,
                  ef_search,
                  args.distance,
                  args.batch,
              )
              for M, ef_con in index_params
              for ef_search in query_params
          ],
          "nmslib": [
              NmslibHNSW(
                  M,
                  ef_con,
                  args.n_threads,
                  ef_search,
                  args.distance,
                  args.batch,
              )
              for M, ef_con in index_params
              for ef_search in query_params
          ],
      }
  
      if args.algo:
          algos = {args.algo: algos[args.algo]}
  
      algos_flat = [(k, v) for k, vals in algos.items() for v in vals]
      random.shuffle(algos_flat)
      n2_logger.debug(
          "order: %s" % str([a.name for _, a in algos_flat])
      )
  
      for library, algo in algos_flat:
          # Spawn a subprocess to force the memory to be reclaimed at the end
          p = multiprocessing.Process(
              target=run_algo, args=(args, library, algo, results_fn)
          )
          p.start()
          p.join()
  
imports: import os
  import sys
  import abc
  import time
  import random
  import psutil
  import logging
  import argparse
  import resource
  import multiprocessing
  import h5py
  import nmslib
  import numpy
  from n2 import HnswIndex
  from metrics import knn_recall, metrics
  from download_dataset import get_dataset_fn, DATASETS
label_desc: Use image node_id 6 for calling a global function with example usage: run(args) without return types