distributed_test
allennlp.common.testing.distributed_test
init_process#
def init_process(
process_rank: int,
world_size: int,
distributed_device_ids: List[int],
func: Callable,
func_args: Tuple = None,
func_kwargs: Dict[str, Any] = None,
master_addr: str = "127.0.0.1",
master_port: int = 29500
)
run_distributed_test#
def run_distributed_test(
device_ids: List[int] = None,
func: Callable = None,
*args,
**kwargs
)
This runs the func
in a simulated distributed environment.
Parameters
-
device_ids :
List[int]
List of devices. There need to be at least 2 devices. Default is [-1, -1]. -
func :
Callable
func
needs to be global for spawning the processes, so that it can be pickled.