File tree Expand file tree Collapse file tree 1 file changed +18
-8
lines changed Expand file tree Collapse file tree 1 file changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ class ServerArgs:
68
68
# Port for the HTTP server
69
69
host : str = "127.0.0.1"
70
70
port : int = 30000
71
+ nccl_port : Optional [int ] = None
71
72
72
73
# Memory and scheduling
73
74
mem_fraction_static : Optional [float ] = None
@@ -599,6 +600,12 @@ def add_cli_args(parser: argparse.ArgumentParser):
599
600
default = ServerArgs .port ,
600
601
help = "The port of the HTTP server." ,
601
602
)
603
+ parser .add_argument (
604
+ "--nccl-port" ,
605
+ type = int ,
606
+ default = ServerArgs .nccl_port ,
607
+ help = "The port for NCCL distributed environment setup. Defaults to a random port." ,
608
+ )
602
609
parser .add_argument (
603
610
"--tokenizer-mode" ,
604
611
type = str ,
@@ -1747,14 +1754,17 @@ class PortArgs:
1747
1754
1748
1755
@staticmethod
1749
1756
def init_new (server_args , dp_rank : Optional [int ] = None ) -> "PortArgs" :
1750
- port = server_args .port + random .randint (100 , 1000 )
1751
- while True :
1752
- if is_port_available (port ):
1753
- break
1754
- if port < 60000 :
1755
- port += 42
1756
- else :
1757
- port -= 43
1757
+ if server_args .nccl_port is None :
1758
+ port = server_args .port + random .randint (100 , 1000 )
1759
+ while True :
1760
+ if is_port_available (port ):
1761
+ break
1762
+ if port < 60000 :
1763
+ port += 42
1764
+ else :
1765
+ port -= 43
1766
+ else :
1767
+ port = server_args .nccl_port
1758
1768
1759
1769
if not server_args .enable_dp_attention :
1760
1770
# Normal case, use IPC within a single node
You can’t perform that action at this time.
0 commit comments