MCPcopy Index your code
hub / github.com/apache/tvm / PopenPoolExecutor

Class PopenPoolExecutor

python/tvm/support/popen_pool.py:314–483  ·  view source on GitHub ↗

An parallel executor backed by Popen processes. Parameters ---------- max_worker : int Maximum number of workers timeout : float Timeout value for each function submit. initializer: callable or None A callable initializer, or None initargs: Tuple[o

Source from the content-addressed store, hash-verified

312
313
314class PopenPoolExecutor:
315 """An parallel executor backed by Popen processes.
316
317 Parameters
318 ----------
319 max_worker : int
320 Maximum number of workers
321
322 timeout : float
323 Timeout value for each function submit.
324
325 initializer: callable or None
326 A callable initializer, or None
327
328 initargs: Tuple[object]
329 A tuple of args for the initializer
330
331 maximum_process_uses: Optional[int]
332 The maximum number of times each process can be used before being recycled,
333 i.e. killed and restarted. If `None`, processes will be reused until an
334 operation times out.
335
336 stdout: Union[None, int, IO[Any]]
337 The standard output streams handler specified for the workers in the pool.
338
339 stderr: Union[None, int, IO[Any]]
340 The standard error streams handler specified for the workers in the pool.
341
342 Note
343 ----
344 If max_workers is NONE then the number returned by
345 os.cpu_count() is used. This method aligns with the
346 behavior of multiprocessing.pool().
347 """
348
349 def __init__(
350 self,
351 max_workers=None,
352 timeout=None,
353 initializer=None,
354 initargs=(),
355 maximum_process_uses=None,
356 stdout=None,
357 stderr=None,
358 ):
359 if max_workers is None:
360 max_workers = os.cpu_count()
361 # Use an internal thread pool to send to popen workers
362 self._threadpool = concurrent.futures.ThreadPoolExecutor(max_workers=max_workers)
363 self._timeout = timeout
364 self._worker_map = {}
365 self._lock = threading.Lock()
366 self._initializer = initializer
367 self._initargs = initargs
368 self._maximum_process_uses = maximum_process_uses
369 self._stdout = stdout
370 self._stderr = stderr
371 self._shutdown = False

Callers 7

__init__Method · 0.90
__init__Method · 0.90
buildMethod · 0.90
_sanity_checkMethod · 0.90
test_popen_pool_executorFunction · 0.90

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…