Skip to content

Commit a6ae79a

Browse files
authored
Update ddp tutorial to tell user that TcpStore has been enabled on Windows platform (#1321)
* Update tutorial to tell user that TcpStore has been enabled on Windows * Resolve review comments
1 parent f0e8673 commit a6ae79a

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

intermediate_source/ddp_tutorial.rst

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -80,28 +80,24 @@ be found in
8080
8181
from torch.nn.parallel import DistributedDataParallel as DDP
8282
83+
# On Windows platform, the torch.distributed package only
84+
# supports Gloo backend, FileStore and TcpStore.
85+
# For FileStore, set init_method parameter in init_process_group
86+
# to a local file. Example as follow:
87+
# init_method="file:///f:/libtmp/some_file"
88+
# dist.init_process_group(
89+
# "gloo",
90+
# rank=rank,
91+
# init_method=init_method,
92+
# world_size=world_size)
93+
# For TcpStore, same way as on Linux.
8394
8495
def setup(rank, world_size):
85-
if sys.platform == 'win32':
86-
# Distributed package only covers collective communications with Gloo
87-
# backend and FileStore on Windows platform. Set init_method parameter
88-
# in init_process_group to a local file.
89-
# Example init_method="file:///f:/libtmp/some_file"
90-
init_method="file:///{your local file path}"
91-
92-
# initialize the process group
93-
dist.init_process_group(
94-
"gloo",
95-
init_method=init_method,
96-
rank=rank,
97-
world_size=world_size
98-
)
99-
else:
100-
os.environ['MASTER_ADDR'] = 'localhost'
101-
os.environ['MASTER_PORT'] = '12355'
96+
os.environ['MASTER_ADDR'] = 'localhost'
97+
os.environ['MASTER_PORT'] = '12355'
10298
103-
# initialize the process group
104-
dist.init_process_group("gloo", rank=rank, world_size=world_size)
99+
# initialize the process group
100+
dist.init_process_group("gloo", rank=rank, world_size=world_size)
105101
106102
def cleanup():
107103
dist.destroy_process_group()

0 commit comments

Comments
 (0)