@@ -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