MCPcopy
hub / github.com/dmlc/dgl / _shared_setup

Method _shared_setup

python/dgl/optim/pytorch/sparse_optim.py:120–141  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

118 self._comm = True
119
120 def _shared_setup(self):
121 for emb in self._params:
122 emb_name = emb.name
123 if self._rank == 0: # the master gpu process
124 opt_meta = create_shared_mem_array(
125 emb_name + "_opt_meta",
126 (self._world_size, self._world_size),
127 th.int32,
128 ).zero_()
129
130 if self._rank == 0:
131 emb.store.set(emb_name + "_opt_meta", emb_name)
132 self._opt_meta[emb_name] = opt_meta
133 elif self._rank > 0:
134 # receive
135 emb.store.wait([emb_name + "_opt_meta"])
136 opt_meta = get_shared_mem_array(
137 emb_name + "_opt_meta",
138 (self._world_size, self._world_size),
139 th.int32,
140 )
141 self._opt_meta[emb_name] = opt_meta
142
143 def _comm_step(self):
144 with th.no_grad():

Callers 1

stepMethod · 0.95

Calls 3

create_shared_mem_arrayFunction · 0.85
get_shared_mem_arrayFunction · 0.85
waitMethod · 0.45

Tested by

no test coverage detected