Skip to content

Commit

Permalink
another way
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyasMoutawwakil committed Nov 26, 2024
1 parent d7e589c commit 4af7a68
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions optimum_benchmark/launchers/torchrun/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ class TorchrunLauncher(Launcher[TorchrunConfig]):
def __init__(self, config: TorchrunConfig):
super().__init__(config)

if sys.platform == "win32":
self.logger.info("\t+ Disabline libuv on Windows")
os.environ["USE_LIBUV"] = "0"

if get_start_method(allow_none=True) != self.config.start_method:
self.logger.info(f"\t+ Setting multiprocessing start method to {self.config.start_method}")
set_start_method(self.config.start_method, force=True)
Expand Down Expand Up @@ -164,8 +160,14 @@ def entrypoint(worker: Callable[..., BenchmarkReport], worker_args: List[Any], l
device = torch.device("cuda", rank)
torch.cuda.set_device(device)

if sys.platform == "win32":
logger.info("\t+ Disabling libuv for Windows")
init_method = "env://?use_libuv=0"
else:
init_method = "env://"

logger.info("\t+ Initializing torch.distributed process group")
torch.distributed.init_process_group()
torch.distributed.init_process_group(init_method=init_method)

try:
report = worker(*worker_args)
Expand Down

0 comments on commit 4af7a68

Please sign in to comment.