class_docstr: Run generated code on remove devices.
  This function will ask a RPC Tracker to get device for measurement.
  
  Parameters
  ----------
  timeout: float
      The timeout of a RPCRunner measurement task
  n_parallel: int
      The number of tasks run in parallel. "None" will use all cpu cores
  key: str
      The key of the device registered in the tracker
  host: str
      The host address of RPC Tracker
  port: int
      The port of RPC Tracker
  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 "1" 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.
  module_loader : ModuleLoader
      If given, a context manager that loads the module to be timed into the remote runtime.
      If not given, default_module_loader is used.
class_docstr_tok: ["Run","generated","code","on","remove","devices",".","This","function","will","ask","a","RPC","Tracker","to","get","device","for","measurement",".","Parameters","--","--","--","--","--","timeout",":","float","The","timeout","of","a","RPCRunner","measurement","task","n_parallel",":","int","The","number","of","tasks","run","in","parallel",".","``","None","''","will","use","all","cpu","cores","key",":","str","The","key","of","the","device","registered","in","the","tracker","host",":","str","The","host","address","of","RPC","Tracker","port",":","int","The","port","of","RPC","Tracker","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","``","1","''","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",".","module_loader",":","ModuleLoader","If","given",",","a","context","manager","that","loads","the","module","to","be","timed","into","the","remote","runtime",".","If","not","given",",","default_module_loader","is","used","."]
code: def __init__(
      self,
      key,
      host,
      port,
      priority=1,
      timeout=10,
      n_parallel=None,
      number=4,
      repeat=3,
      min_repeat_ms=0,
      cooldown_interval=0.1,
      enable_cpu_cache_flush=False,
      module_loader=None,
  ):
      super(RPCRunner, self).__init__(timeout, n_parallel)
  
      self.key = key
      self.host = host
      self.port = port
      self.priority = priority
      self.timeout = timeout
  
      self.number = number
      self.repeat = repeat
      self.min_repeat_ms = min_repeat_ms
      self._ref_input = None
  
      self.enable_cpu_cache_flush = enable_cpu_cache_flush
      self.cooldown_interval = cooldown_interval
      self.module_loader = module_loader
  
      self.executor = PopenPoolExecutor(
          timeout=timeout * (self.n_parallel + 1),
          initializer=reset_global_scope,
          initargs=(AutotvmGlobalScope.current,),
      )
  
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 1 to create a new RPCRunner object from inherited base classes: Runner with example: obj = RPCRunner(key, host, port, priority, timeout, n_parallel, number, repeat, min_repeat_ms, cooldown_interval, enable_cpu_cache_flush, module_loader)