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

Method bcast_val

imperative/python/megengine/distributed/server.py:124–139  ·  view source on GitHub ↗
(self, val, key, size)

Source from the content-addressed store, hash-verified

122 return future.get()
123
124 def bcast_val(self, val, key, size):
125 with self.lock:
126 if key not in self.bcast_dict:
127 self.bcast_dict[key] = [Future(False), size]
128 arr = self.bcast_dict[key]
129 if val is not None:
130 arr[0].set(val)
131 val = None
132 else:
133 val = arr[0].get()
134 with self.lock:
135 cnt = arr[1] - 1
136 arr[1] = cnt
137 if cnt == 0:
138 del self.bcast_dict[key]
139 return val
140
141 def _del(self, key):
142 with self.lock:

Callers

nothing calls this directly

Calls 3

FutureClass · 0.50
setMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected