Skip to content

Commit

Permalink
Fixed failing test_check_idist_parallel_torch_launch_n_procs_gloo on …
Browse files Browse the repository at this point in the history
…old pytorch versions (#2433)

Fixes #2429
  • Loading branch information
vfdev-5 authored Jan 19, 2022
1 parent 21a2ccc commit 9bbd633
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions tests/ignite/distributed/test_launcher.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import subprocess
import sys
from distutils.version import LooseVersion
from pathlib import Path

import pytest
Expand Down Expand Up @@ -65,12 +66,23 @@ def test_check_idist_parallel_no_dist(exec_filepath):
def _test_check_idist_parallel_torch_launch(init_method, fp, backend, nprocs):
# torchrun --nproc_per_node=nprocs tests/ignite/distributed/check_idist_parallel.py --backend=backend

cmd = [
"torchrun",
cmd = []
if LooseVersion(torch.__version__) >= LooseVersion("1.10.0"):
cmd += ["torchrun"]
else:
cmd += [
sys.executable,
"-m",
"torch.distributed.launch",
"--use_env",
]

cmd += [
f"--nproc_per_node={nprocs}",
fp,
f"--backend={backend}",
]

if init_method is not None:
cmd.append(f"--init_method={init_method}")

Expand Down

0 comments on commit 9bbd633

Please sign in to comment.