class_docstr: Maintains a pool of TuningProcesses to benchmark kernels in parallel
  across devices. By default, we create one TuningProcess per device and
  set the sub-process environment to make only that device visible.
class_docstr_tok: ["Maintains","a","pool","of","TuningProcesses","to","benchmark","kernels","in","parallel","across","devices",".","By","default",",","we","create","one","TuningProcess","per","device","and","set","the","sub-process","environment","to","make","only","that","device","visible","."]
docstr: Benchmark each choice in a separate process.
docstr_tok: ["Benchmark","each","choice","in","a","separate","process","."]
code: def benchmark(
      self,
      choices: List[TritonTemplateCaller],
  ) -> Dict[TritonTemplateCaller, float]:
      """
      Benchmark each choice in a separate process.
      """
      assert (
          self.processes is not None
      ), "Tuning process pool is not initialized"
      assert self.executor is not None
  
      results = {}
  
      # Use a ThreadExecutorPool to spread the work across the subprocesses and
      # to grab subprocesses as soon as they're free.
      for choice, result in zip(
          choices, self.executor.map(self.target, choices)
      ):
          results[choice] = result
  
      return results
  
imports: from __future__ import annotations
  import contextlib
  import dataclasses
  import functools
  import logging
  import os
  import queue
  import time
  import warnings
  from concurrent.futures import ThreadPoolExecutor
  from ctypes import byref, c_size_t, c_void_p
  from multiprocessing.process import BaseProcess
  from multiprocessing.queues import Queue
  from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, TYPE_CHECKING, Union
  import torch
  from torch import multiprocessing
  from torch._dynamo.testing import rand_strided
  from torch._inductor import ir
  from torch._inductor.codecache import CUDACodeCache, DLLWrapper, PyCodeCache
  from .None import config
  from .utils import do_bench
  from .virtualized import V
label_desc: Use image node_id 5 for calling the TuningProcessPool obj's underlying member method code with example usage: obj.benchmark(choices) and returns: results