Home / Function/ setup() — pytorch Function Reference

setup() — pytorch Function Reference

Architecture documentation for the setup() function in dist_util.py from the pytorch codebase.

Entity Profile

Dependency Diagram

graph TD
  9553c3cb_c1ee_9d98_ebf1_e7a19f8ebc17["setup()"]
  24e4ab44_f8ed_b835_f57a_8a13ebaabe74["run_model()"]
  24e4ab44_f8ed_b835_f57a_8a13ebaabe74 -->|calls| 9553c3cb_c1ee_9d98_ebf1_e7a19f8ebc17
  style 9553c3cb_c1ee_9d98_ebf1_e7a19f8ebc17 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

benchmarks/dynamo/dist_util.py lines 25–30

def setup(rank, world_size):
    os.environ["MASTER_ADDR"] = os.getenv("MASTER_ADDR", "localhost")
    os.environ["MASTER_PORT"] = os.getenv("MASTER_PORT", "12355")
    os.environ["RANK"] = os.getenv("RANK", "0")
    os.environ["WORLD_SIZE"] = os.getenv("WORLD_SIZE", "1")
    dist.init_process_group("nccl")

Subdomains

Called By

Frequently Asked Questions

What does setup() do?
setup() is a function in the pytorch codebase.
What calls setup()?
setup() is called by 1 function(s): run_model.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free