MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / __init__

Method __init__

imperative/python/megengine/distributed/launcher.py:85–109  ·  view source on GitHub ↗
(
        self,
        func,
        n_gpus=None,
        world_size=None,
        rank_start=0,
        master_ip="localhost",
        port=0,
        device_type="xpu",
        backend="nccl",
    )

Source from the content-addressed store, hash-verified

83 return super().__new__(cls)
84
85 def __init__(
86 self,
87 func,
88 n_gpus=None,
89 world_size=None,
90 rank_start=0,
91 master_ip="localhost",
92 port=0,
93 device_type="xpu",
94 backend="nccl",
95 ):
96 self.func = func
97 self.n_gpus = n_gpus if n_gpus is not None else get_device_count(device_type)
98 self.world_size = world_size if world_size is not None else self.n_gpus
99 self.rank_start = rank_start
100 self.master_ip = master_ip
101 self.port = port
102 self.device_type = device_type
103 self.backend = backend
104 # master node create server
105 if self.rank_start == 0:
106 self.server = Server(self.port)
107 self.port = self.server.py_server_port
108 else:
109 assert self.port != 0, "you have to assign a port for distributed server"
110
111 def __call__(self, *args, **kwargs):
112 procs = []

Callers

nothing calls this directly

Calls 2

get_device_countFunction · 0.85
ServerClass · 0.85

Tested by

no test coverage detected