-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelp_read_sglang_result.py
More file actions
49 lines (42 loc) · 1.54 KB
/
help_read_sglang_result.py
File metadata and controls
49 lines (42 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env python
import os
mapping = dict()
def read_all_files_in_folder(folder_path):
# Loop through all the files in the folder
for filename in os.listdir(folder_path):
file_path = os.path.join(folder_path, filename)
if 'batch' in file_path:
tmp = file_path.split('_')
print()
bs = tmp[3].split('batch')
bs = int(bs[1])
input_ = tmp[4].split('input')
input_ = int(input_[1])
output_ = tmp[5].split('output')
output_ = int(output_[1])
tp = tmp[6].split('tp')
tp = tp[1].split('.txt')
tp = int(tp[0])
key = (bs, input_, output_, tp)
val = file_path
mapping[key] = val
read_all_files_in_folder('./')
print(mapping.keys())
print((1, 128, 128, 8) in mapping)
for tp in [8, 4]:
for il in [128, 2048]:
for ol in [128, 2048]:
for bs in range(1, 9):
if (2**bs, il, ol, tp) in mapping:
path = mapping[(2**bs, il, ol, tp)]
print((2**bs, il, ol, tp))
file1 = open(path, 'r')
Lines = file1.readlines()
cnt = 0
for line in Lines:
if 'median latency' in line.strip():
cnt += 1
tmp = line.strip()
tmp = tmp.split()
if cnt % 2 == 0:
print(float(tmp[3]) * 1000)