MCPcopy Index your code
hub / github.com/Project-MONAI/MONAI / _wrapper

Method _wrapper

tests/test_utils.py:590–607  ·  view source on GitHub ↗
(*args, **kwargs)

Source from the content-addressed store, hash-verified

588
589 @functools.wraps(obj)
590 def _wrapper(*args, **kwargs):
591 tmp = torch.multiprocessing.get_context(self.method)
592 processes = []
593 results = tmp.Queue()
594 func = _call_original_func
595 args = [obj.__name__, obj.__module__] + list(args)
596
597 for proc_rank in range(self.nproc_per_node):
598 run_args = (func, proc_rank, args, kwargs, results)
599 p = tmp.Process(target=self.run_process, args=run_args, daemon=self.daemon)
600 p.start()
601 processes.append(p)
602
603 for p in processes:
604 p.join()
605 pr = results.get(block=False)
606 assert pr is True, f"Distributed call failed: {pr}"
607 _del_original_func(obj)
608
609 return _wrapper
610

Callers

nothing calls this directly

Calls 4

_del_original_funcFunction · 0.85
getMethod · 0.80
startMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected