MCPcopy Create free account
hub / github.com/pytorch/pytorch / process_pool

Method process_pool

torch/_inductor/codecache.py:2360–2378  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2358 @staticmethod
2359 @functools.lru_cache(1)
2360 def process_pool() -> ProcessPoolExecutor:
2361 # ensure properties have been calculated before processes
2362 # are forked
2363 caching_device_properties()
2364 assert config.compile_threads > 1
2365 orig_ppid = os.getpid()
2366
2367 ctx = multiprocessing.get_context(config.worker_start_method)
2368 pool = ProcessPoolExecutor(
2369 config.compile_threads,
2370 mp_context=ctx,
2371 initializer=partial(_async_compile_initializer, orig_ppid),
2372 )
2373 # when this pool is created in a subprocess object, the normal exit handler
2374 # doesn't run, and we need to register our own handler.
2375 # exitpriority has to be high, because another one of the finalizers will
2376 # kill the worker thread that sends the shutdown message to the workers...
2377 multiprocessing.util.Finalize(None, pool.shutdown, exitpriority=sys.maxsize)
2378 return pool
2379
2380 @classmethod
2381 def warm_pool(cls) -> None:

Callers 2

tritonMethod · 0.95
warm_poolMethod · 0.80

Calls 2

get_contextMethod · 0.80

Tested by

no test coverage detected