Enable distributed package on windows, Gloo backend supported only (#42897)

Summary:
Fixes https://github.com/pytorch/pytorch/issues/42095

For test case part will be committed to this PR later

mrshenli, please help to review

Pull Request resolved: https://github.com/pytorch/pytorch/pull/42897

Reviewed By: osalpekar

Differential Revision: D23841786

Pulled By: mrshenli

fbshipit-source-id: 334ba1ed73eff2f668857390fc32d1bc7f08e5f3
This commit is contained in:
gunandrose4u
2020-09-24 21:12:16 -07:00
committed by Facebook GitHub Bot
parent c6500bcf14
commit 0122299f9b
39 changed files with 462 additions and 167 deletions

View File

@ -6,9 +6,12 @@ except ImportError:
import torch._six as six
import numbers
import os
from . import FileStore, TCPStore
import sys
from . import FileStore
from .constants import default_pg_timeout
if sys.platform != 'win32':
from . import TCPStore
_rendezvous_handlers = {}
@ -90,6 +93,10 @@ def _file_rendezvous_handler(url, **kwargs):
result = urlparse(url)
path = result.path
if sys.platform == 'win32':
import urllib.request
path = urllib.request.url2pathname(result.path)
if not path:
raise _error("path missing")
query = dict(pair.split("=") for pair in filter(None, result.query.split("&")))
@ -175,7 +182,8 @@ def _env_rendezvous_handler(url, timeout=default_pg_timeout, **kwargs):
# If this configuration is invalidated, there is nothing we can do about it
raise RuntimeError("Unable to perform rerendezvous using env:// method")
if sys.platform != 'win32':
register_rendezvous_handler("tcp", _tcp_rendezvous_handler)
register_rendezvous_handler("env", _env_rendezvous_handler)
register_rendezvous_handler("file", _file_rendezvous_handler)
register_rendezvous_handler("tcp", _tcp_rendezvous_handler)
register_rendezvous_handler("env", _env_rendezvous_handler)