1313# scenarios (name, input_len, output_len, concurrency)
1414SCENARIOS = [
1515 # from FlagScale
16- ("p128d128" , 128 , 128 , 100 ),
17- ("p6144d128" , 6144 , 128 , 100 ),
18- ("p30720d128" , 30720 , 128 , 100 ),
19- ("p128d6144" , 128 , 6144 , 100 ),
20- ("p6144d6144" , 6144 , 6144 , 100 ),
21- ("p30720d6144" , 30720 , 6144 , 100 ),
16+ ("p128d128" , 128 , 128 , 100 ),
17+ ("p6144d128" , 6144 , 128 , 100 ),
18+ ("p30720d128" , 30720 , 128 , 100 ),
19+ ("p128d6144" , 128 , 6144 , 100 ),
20+ ("p6144d6144" , 6144 , 6144 , 100 ),
21+ ("p30720d6144" , 30720 , 6144 , 100 ),
2222 # from FlagRelease
23- ("p4096d2048" , 4096 , 2048 , 64 ),
23+ ("p4096d2048" , 4096 , 2048 , 64 ),
2424 # from vendors
25- ("p6144d1024" , 6144 , 1024 , 100 ),
26- ("p4096d1024" , 4096 , 1024 , 100 ),
27- ("p2048d1024" , 2048 , 1024 , 100 ),
28- ("p1024d1024" , 1024 , 1024 , 100 ),
25+ ("p6144d1024" , 6144 , 1024 , 100 ),
26+ ("p4096d1024" , 4096 , 1024 , 100 ),
27+ ("p2048d1024" , 2048 , 1024 , 100 ),
28+ ("p1024d1024" , 1024 , 1024 , 100 ),
2929]
3030
3131LOG_DIR = "vllm_bench_logs"
3232os .makedirs (LOG_DIR , exist_ok = True )
3333
34- NUM_RUNS = 4
34+ NUM_RUNS = 4
3535# ====================
3636
37+
3738def run_benchmark (name , input_len , output_len , concurrency , run_id ):
3839 num_prompts = concurrency
3940 cmd = [
40- "vllm" , "bench" , "serve" ,
41- "--host" , HOST ,
42- "--port" , str (PORT ),
43- "--backend" , BACKEND ,
44- "--model" , SERVED_MODEL_NAME ,
45- "--tokenizer" , "Qwen/Qwen3-Next-80B-A3B-Instruct" ,
46- "--dataset-name" , "random" ,
47- "--endpoint" , ENDPOINT ,
41+ "vllm" ,
42+ "bench" ,
43+ "serve" ,
44+ "--host" ,
45+ HOST ,
46+ "--port" ,
47+ str (PORT ),
48+ "--backend" ,
49+ BACKEND ,
50+ "--model" ,
51+ SERVED_MODEL_NAME ,
52+ "--tokenizer" ,
53+ "Qwen/Qwen3-Next-80B-A3B-Instruct" ,
54+ "--dataset-name" ,
55+ "random" ,
56+ "--endpoint" ,
57+ ENDPOINT ,
4858 "--ignore-eos" ,
4959 "--trust-remote-code" ,
50- "--random-input-len" , str (input_len ),
51- "--random-output-len" , str (output_len ),
52- "--num-prompts" , str (num_prompts ),
53- "--max-concurrency" , str (concurrency )
60+ "--random-input-len" ,
61+ str (input_len ),
62+ "--random-output-len" ,
63+ str (output_len ),
64+ "--num-prompts" ,
65+ str (num_prompts ),
66+ "--max-concurrency" ,
67+ str (concurrency ),
5468 ]
5569
5670 log_file = os .path .join (LOG_DIR , f"{ name } _run{ run_id } .log" )
57- print (f"\n [{ datetime .now ().strftime ('%Y-%m-%d %H:%M:%S' )} ] 🚀 Starting scenario: { name } (Run { run_id } )" )
71+ print (
72+ f"\n [{ datetime .now ().strftime ('%Y-%m-%d %H:%M:%S' )} ] 🚀 Starting scenario: { name } (Run { run_id } )"
73+ )
5874 print (f" Input: { input_len } , Output: { output_len } , Concurrency: { concurrency } " )
5975 print (f" Logging to: { log_file } " )
6076 print (f" Command: { ' ' .join (cmd )} \n " )
@@ -63,14 +79,20 @@ def run_benchmark(name, input_len, output_len, concurrency, run_id):
6379 result = subprocess .run (cmd , stdout = f , stderr = subprocess .STDOUT , text = True )
6480
6581 status = "✅ Success" if result .returncode == 0 else "❌ Failed"
66- print (f"[{ datetime .now ().strftime ('%Y-%m-%d %H:%M:%S' )} ] { status } : { name } Run { run_id } (exit code: { result .returncode } )\n " )
82+ print (
83+ f"[{ datetime .now ().strftime ('%Y-%m-%d %H:%M:%S' )} ] { status } : { name } Run { run_id } (exit code: { result .returncode } )\n "
84+ )
85+
6786
6887def main ():
69- print (f"🧪 Starting vLLM benchmark suite for { len (SCENARIOS )} scenarios, each repeated { NUM_RUNS } times...\n " )
88+ print (
89+ f"🧪 Starting vLLM benchmark suite for { len (SCENARIOS )} scenarios, each repeated { NUM_RUNS } times...\n "
90+ )
7091 for name , inp , out , conc in SCENARIOS :
7192 for run_id in range (1 , NUM_RUNS + 1 ):
7293 run_benchmark (name , inp , out , conc , run_id )
7394 print ("🏁 All scenarios and runs completed. Logs saved in:" , LOG_DIR )
7495
96+
7597if __name__ == "__main__" :
7698 main ()
0 commit comments