os.getuid is not available on windows
Summary:
Pull Request resolved:
@@ -12,6 +12,7 @@ since they are meant to represent the "common default behavior" people need in t
import argparse
import logging
import os
+import sys
from collections import OrderedDict
import torch
from fvcore.common.file_io import PathManager
@@ -69,7 +70,7 @@ def default_argument_parser():
# PyTorch still may leave orphan processes in multi-gpu training.
# Therefore we use a deterministic way to obtain port,
# so that users are aware of orphan processes by seeing the port occupied.
- port = 2 ** 15 + 2 ** 14 + hash(os.getuid()) % 2 ** 14
+ port = 2 ** 15 + 2 ** 14 + hash(os.getuid() if sys.platform != "win32" else 1) % 2 ** 14
parser.add_argument("--dist-url", default="tcp://127.0.0.1:{}".format(port))
parser.add_argument(
"opts",
