Last active
November 20, 2023 20:33
-
-
Save stas00/58faf392b73609a9c6bca77b495099cd to your computer and use it in GitHub Desktop.
Profiling `init_process_group('nccl')`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# run as: | |
# python -u -m torch.distributed.run --nproc_per_node=8 --rdzv_endpoint localhost:6000 --rdzv_backend c10d benchmark_dist_init.py | |
import torch | |
import os | |
import cProfile | |
import torch.distributed as dist | |
import timeit | |
def init(): | |
dist.init_process_group('nccl') | |
local_rank = int(os.environ["LOCAL_RANK"]) | |
if local_rank == 0: | |
cProfile.run("init()", sort="tottime") | |
else: | |
init() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment