From c66f82b0452192d64a16e0b9ca54476ffc0135fa Mon Sep 17 00:00:00 2001 From: Hongtao Zhang Date: Sun, 26 Jul 2026 23:49:39 +0000 Subject: [PATCH 1/2] Fix single-node torch.distributed: use torchrun --standalone Single-node runs passed no rendezvous args, so torchrun used the fixed default port 29500, causing transient EADDRINUSE collisions between consecutive distributed benchmarks (e.g. model-benchmarks:resnet). Use --standalone so torchrun binds a random free port. Multi-node path unchanged; runner unit test expectation updated. --- superbench/runner/runner.py | 5 ++++- tests/runner/test_runner.py | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/superbench/runner/runner.py b/superbench/runner/runner.py index a5ac13cbb..e80ece005 100644 --- a/superbench/runner/runner.py +++ b/superbench/runner/runner.py @@ -154,8 +154,11 @@ def __get_mode_command(self, benchmark_name, mode, timeout=None): elif mode.name == 'torch.distributed': # TODO: replace with torch.distributed.run in v1.9 # TODO: only supports node_num=1 and node_num=all currently + # For single-node runs use torchrun's standalone rendezvous, which binds a random free + # port instead of the fixed default (29500). This avoids transient EADDRINUSE failures + # when consecutive distributed benchmarks reuse the same rendezvous port. torch_dist_params = ( - '' if 'node_num' in mode and mode.node_num == 1 else + '--standalone ' if 'node_num' in mode and mode.node_num == 1 else '--nnodes=$NNODES --node_rank=$NODE_RANK --master_addr=$MASTER_ADDR --master_port=$MASTER_PORT ' ) diff --git a/tests/runner/test_runner.py b/tests/runner/test_runner.py index fd45ae0a8..2280a5fc7 100644 --- a/tests/runner/test_runner.py +++ b/tests/runner/test_runner.py @@ -141,6 +141,7 @@ def test_get_mode_command(self): 'expected_command': ( 'torchrun ' '--no_python --nproc_per_node=8 ' + '--standalone ' f'sb exec --output-dir {self.sb_output_dir} -c sb.config.yaml -C superbench.enable=foo ' 'superbench.benchmarks.foo.parameters.distributed_impl=ddp ' 'superbench.benchmarks.foo.parameters.distributed_backend=nccl' From 3b59d5e30a72aa3f2621e70a18fbb6c3198e0ec5 Mon Sep 17 00:00:00 2001 From: Hongtao Zhang Date: Fri, 31 Jul 2026 17:30:13 +0000 Subject: [PATCH 2/2] CI/CD - Only cap setuptools below 66 for Python 3.7 torch pulls in an unpinned setuptools during 'pip install .[test,cpuworker]', which upgrades the 65.7 pinned by the pipeline to 83.0.0 and makes the setup.py guard raise VersionConflict on the python-3.10 lint job. setuptools 66+ only drops Python 3.7, so keep the cap there only. --- setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 53f754a5d..85b7efc80 100644 --- a/setup.py +++ b/setup.py @@ -19,8 +19,10 @@ print(f'Python {sys.version_info.major}.{sys.version_info.minor} detected.') if sys.version_info[:2] < (3, 11): import pkg_resources + # setuptools 66+ no longer supports Python 3.7, newer runtimes work with any recent version. + setuptools_req = 'setuptools>=45, <66' if sys.version_info[:2] < (3, 8) else 'setuptools>=45' try: - pkg_resources.require(['pip>=18', 'setuptools>=45, <66']) + pkg_resources.require(['pip>=18', setuptools_req]) except (pkg_resources.VersionConflict, pkg_resources.DistributionNotFound): print( '\033[93mTry update pip/setuptools versions, for example, '