Skip to content

Commit

Permalink
Fix all Pipeline Module Parameters being sent to cuda:0 (#687)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdtblck authored Apr 21, 2021
1 parent 0b80ad0 commit 669028f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion deepspeed/runtime/pipe/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ def forward(self, inputs):
self.world_group = dist.new_group(ranks=range(dist.get_world_size()))
self.global_rank = dist.get_rank(group=self.world_group)
self.world_size = dist.get_world_size(group=self.world_group)
self.local_rank = int(os.environ.get("LOCAL_RANK", None))
assert self.local_rank != None

if topology:
self._topo = topology
Expand Down Expand Up @@ -189,7 +191,7 @@ def forward(self, inputs):

#with torch.random.fork_rng(devices=[torch.cuda.current_device()]):
self._build()
self.to('cuda')
self.to(f'cuda:{self.local_rank}')

self.tied_comms = self._index_tied_modules()
self._synchronize_tied_weights()
Expand Down

0 comments on commit 669028f

Please sign in to comment.