Skip to content

distributed_test

[ allennlp.common.testing.distributed_test ]


init_process#

def init_process(
    process_rank: int,
    distributed_device_ids: List[int] = None,
    world_size: int = 1,
    func: Callable = None,
    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] = [-1, -1],
    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.