Skip to content

Commit

Permalink
Use device-agnostic accelerator API.
Browse files Browse the repository at this point in the history
Signed-off-by: Jagadish Krishnamoorthy <[email protected]>
  • Loading branch information
jagadish-amd committed Oct 15, 2024
1 parent 3d679a5 commit 7f91988
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions training/cifar/cifar10_deepspeed.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,7 @@ def main(args):
# Initialize DeepSpeed distributed backend.
deepspeed.init_distributed()
_local_rank = int(os.environ.get("LOCAL_RANK"))
torch_device = torch.device(f"cuda:{_local_rank}")
torch.cuda.set_device(torch_device)
get_accelerator().set_device(_local_rank)

########################################################################
# Step1. Data Preparation.
Expand Down

0 comments on commit 7f91988

Please sign in to comment.