deepspeedai / deepspeedai/DeepSpeed

[REQUEST] Expose TP/DP/PP Rank as Environment Variable for integration with low Level Profiling Tools

Open
#7,423 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
43.1k
Forks
5k
Avg merge
4d 15h
Merged PRs (30d)
112

Description

First, thank you for providing such a powerful and scalable framework for distributed training.

I would like to propose a small but practical feature that would help with system-level profiling using external tracing tools like CUPTI.

While torchrun already sets RANK, LOCAL_RANK, and WORLD_SIZE as environment variables, DeepSpeed
internally computes parallelism ranks: TP / DP/ PP Rank using APIs like topo.get_tensor_model_parallel_rank( )

However, these ranks are not exposed as environment variables, which makes it difficult to access them from low level tools such as CUPTI.

Would you consider adding the following environment variables after initialize parallelism?

like

    os.environ["TP_RANK"] = str(self._topo.get_tensor_model_parallel_rank(rank))
    os.environ["PP_RANK"] = str(self._topo.get_pipeline_model_parallel_rank(rank))
    os.environ["DP_RANK"] = str(self._topo.get_data_parallel_rank(rank))

Would you consider accepting a PR for this?

Thank you again for your work and consideration!
Looking forward to your thoughts.

Best Regards.
[Woosung Myung]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the topology initialization code that calls get_tensor_model_parallel_rank(), get_pipeline_model_parallel_rank(), and get_data_parallel_rank(). Verify how ranks are computed after parallelism initialization, then expose the three requested environment variables and confirm they are available to external profiling tools after initialization.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
distributed-systems, machine-learning
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.