class_docstr: Run generated code on local devices.
  
  Parameters
  ----------
  timeout: float
      The timeout of a compilation
  number: int
      The number of times to run the generated code for taking average.
      We call these runs as one `repeat` of measurement.
  repeat : int, optional
      The number of times to repeat the measurement.
      In total, the generated code will be run (1 + number x repeat) times,
      where the first one is warm up and will be discarded.
      The returned result contains `repeat` costs,
      each of which is an average of `number` costs.
  min_repeat_ms: int, optional
      The minimum duration of one `repeat` in milliseconds.
      By default, one `repeat` contains `number` runs. If this parameter is set,
      the parameters `number` will be dynamically adjusted to meet the
      minimum duration requirement of one `repeat`.
      i.e., When the run time of one `repeat` falls below this time, the `number` parameter
      will be automatically increased.
  cooldown_interval: float, optional
      The cool down interval between two measurements.
  enable_cpu_cache_flush: bool
      Whether to flush cache on CPU between repeated measurements.
      Flushing cache can make the measured latency of one operator closer to
      its actual latency during end-to-end inference.
      To make this option effective, the argument `number` should also be set to 1.
      This is only has effect on CPU task.
  Note
  ----
  This is a "fake" local mode. We start a silent rpc tracker and rpc server
  for the user. In this way we reuse timeout/isolation mechanism in RPC infrastructure.
class_docstr_tok: ["Run","generated","code","on","local","devices",".","Parameters","--","--","--","--","--","timeout",":","float","The","timeout","of","a","compilation","number",":","int","The","number","of","times","to","run","the","generated","code","for","taking","average",".","We","call","these","runs","as","one","`","repeat","`","of","measurement",".","repeat",":","int",",","optional","The","number","of","times","to","repeat","the","measurement",".","In","total",",","the","generated","code","will","be","run","(","1","+","number","x","repeat",")","times",",","where","the","first","one","is","warm","up","and","will","be","discarded",".","The","returned","result","contains","`","repeat","`","costs",",","each","of","which","is","an","average","of","`","number","`","costs",".","min_repeat_ms",":","int",",","optional","The","minimum","duration","of","one","`","repeat","`","in","milliseconds",".","By","default",",","one","`","repeat","`","contains","`","number","`","runs",".","If","this","parameter","is","set",",","the","parameters","`","number","`","will","be","dynamically","adjusted","to","meet","the","minimum","duration","requirement","of","one","`","repeat","`",".","i.e.",",","When","the","run","time","of","one","`","repeat","`","falls","below","this","time",",","the","`","number","`","parameter","will","be","automatically","increased",".","cooldown_interval",":","float",",","optional","The","cool","down","interval","between","two","measurements",".","enable_cpu_cache_flush",":","bool","Whether","to","flush","cache","on","CPU","between","repeated","measurements",".","Flushing","cache","can","make","the","measured","latency","of","one","operator","closer","to","its","actual","latency","during","end-to-end","inference",".","To","make","this","option","effective",",","the","argument","`","number","`","should","also","be","set","to","1",".","This","is","only","has","effect","on","CPU","task",".","Note","--","--","This","is","a","``","fake","''","local","mode",".","We","start","a","silent","rpc","tracker","and","rpc","server","for","the","user",".","In","this","way","we","reuse","timeout\/isolation","mechanism","in","RPC","infrastructure","."]
code: def set_task(self, task):
      # pylint: disable=import-outside-toplevel
      from ...rpc.server import Server
      from ...rpc.tracker import Tracker
  
      self.task = task
      tracker = Tracker(port=9000, port_end=10000, silent=True)
      device_key = f"$local$device${tracker.port}"
      server = Server(
          port=9000,
          port_end=10000,
          key=device_key,
          silent=True,
          tracker_addr=("127.0.0.1", tracker.port),
      )
      self.key = device_key
      self.host = "127.0.0.1"
      self.port = tracker.port
  
      super(LocalRunner, self).set_task(task)
      return server, tracker
  
imports: import contextlib
  import logging
  import os
  import shutil
  import tempfile
  import threading
  import time
  import traceback
  import typing
  import warnings
  from collections import namedtuple
  from random import getrandbits
  import tvm._ffi
  import tvm.ir.transform
  from tvm import nd
  from tvm import rpc
  from tvm.autotvm.env import AutotvmGlobalScope, reset_global_scope
  from tvm.contrib import ndk, stackvm, tar
  from tvm.contrib.popen_pool import PopenPoolExecutor
  from tvm.driver import build
  from tvm.error import TVMError
  from tvm.target import Target
  from ..env import AutotvmGlobalScope
  from ..task.space import InstantiationError
  from ..utils import get_const_tuple
  from .measure import Builder, MeasureErrorNo, MeasureResult, Runner
label_desc: Use image node_id 2 for calling the LocalRunner obj's underlying member method code with example usage: obj.set_task(task) and returns: server,  tracker