Skip to content

Commit 0d573e9

Browse files
committed
save
1 parent 01da72c commit 0d573e9

File tree

10 files changed

+5603
-14585
lines changed

10 files changed

+5603
-14585
lines changed

change_content.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
if [ $# -ne 1 ]; then
4+
echo "Usage: $0 new_format"
5+
exit 1
6+
fi
7+
8+
filename="/home/lrq/proj/vllm/liquid_server.py"
9+
10+
newline=" '-pattern', 'azure-code-"
11+
medium=$1
12+
suffix="-5',"
13+
content="${newline}${medium}${suffix}"
14+
# 替换第 59 行的内容
15+
sed -i "59s/.*/${content}/" "$filename"
16+
17+
echo "Line 59 in $filename has been updated."

change_name.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
if [ $# -ne 1 ]; then
4+
echo "Usage: $0 new_format"
5+
exit 1
6+
fi
7+
8+
cd "/home/lrq/proj/vllm"
9+
new_filename="$1"
10+
prefix="liquid_results_"
11+
new_full_name="${prefix}${new_filename}.json"
12+
touch liquid_results.json
13+
mv liquid_results.json $new_full_name
14+
15+
cd "/home/lrq/proj/vllm"
16+
prefix="output_"
17+
new_full_name="${prefix}${new_filename}.txt"
18+
touch output.txt
19+
mv output.txt $new_full_name

exp.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
run_experiment() {
3+
pattern=$1 # 第一个参数作为 pattern 传入
4+
5+
# 拼接 newname
6+
newname="code_${pattern}"
7+
8+
# 执行更改内容的脚本,传入 pattern
9+
/home/lrq/proj/vllm/change_content.sh $pattern
10+
11+
#start exp
12+
/home/lrq/anaconda3/envs/vllml/bin/python /home/lrq/proj/vllm/liquid_server.py
13+
14+
15+
/home/lrq/proj/vllm/kill_router.sh
16+
/home/lrq/proj/vllm/kill_gpu.sh
17+
18+
/home/lrq/proj/vllm/change_name.sh $newname
19+
}
20+
21+
run_experiment 50
22+
run_experiment 60
23+
run_experiment 70
24+
run_experiment 80
25+
run_experiment 90
26+
run_experiment 100
27+
run_experiment 110
28+
run_experiment 120
29+
run_experiment 130

kill_gpu.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
pids=$(nvidia-smi --query-compute-apps=pid --format=csv,noheader,nounits)
4+
5+
# 遍历所有 PID 并杀掉相应的进程
6+
for pid in $pids; do
7+
echo "Killing process with PID: $pid"
8+
kill -9 $pid
9+
done
10+
11+
echo "All GPU processes have been killed."

kill_router.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
kill_processes_by_name() {
4+
process_name="$1"
5+
pids=$(ps aux | grep $process_name | grep -v grep | awk '{print $2}')
6+
7+
if [ -z "$pids" ]; then
8+
echo "No processes named $process_name found."
9+
else
10+
for pid in $pids; do
11+
echo "Killing process with PID: $pid"
12+
kill -9 $pid
13+
done
14+
echo "All processes named $process_name have been killed."
15+
fi
16+
}
17+
18+
kill_processes_by_name "LLMLoadgen"

liquid_server.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def __init__(self) -> None:
2222
liquid_gpu_space = 32,
2323
liquid_driver_gpu_id = 0,
2424
liquid_total_num_shards = 4,
25-
# gpu_memory_utilization=0.7,
25+
gpu_memory_utilization=0.85,
2626
)
2727
with open(output_file_name, "w"):
2828
pass
@@ -56,8 +56,8 @@ def start(self):
5656

5757
command = [
5858
'./LLMLoadgen',
59-
'-pattern', 'azure-conv-50-5',
60-
'-dataset', 'azure-conv',
59+
'-pattern', 'azure-code-50-5',
60+
'-dataset', 'azure-code',
6161
'-dst', 'liquid',
6262
'-ip', 'localhost',
6363
'-port', '8000',

log.txt

Lines changed: 4114 additions & 6247 deletions
Large diffs are not rendered by default.

main.py

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,25 @@ def main():
2020
liquid_gpu_space = 32,
2121
liquid_driver_gpu_id = 0,
2222
liquid_total_num_shards = 4,
23+
gpu_memory_utilization=0.8,
2324
)
24-
sampling_params = SamplingParams(temperature=0, min_tokens=4, max_tokens=4)
25+
sampling_params = SamplingParams(temperature=0, min_tokens=128, max_tokens=128)
2526
request_num = 1
2627
word = "what is LLM?"
2728
prompt = word
2829
inputs = [prompt for _ in range(request_num)]
2930

30-
liquid_request = LiquidRequest(LiquidType.LIQUID_1_2)
31-
llm.do_liquid(liquid_request)
32-
output = llm.generate(inputs, sampling_params=sampling_params)
33-
print(f"output: {output[0].outputs[0].text}")
34-
liquid_request = LiquidRequest(LiquidType.LIQUID_2_4)
35-
llm.do_liquid(liquid_request)
36-
# liquid_request = LiquidRequest(LiquidType.LIQUID_4_2)
37-
# llm.do_liquid(liquid_request)
38-
# liquid_request = LiquidRequest(LiquidType.LIQUID_2_1)
39-
# llm.do_liquid(liquid_request)
40-
31+
for i in range(25):
32+
liquid_request = LiquidRequest(LiquidType.LIQUID_1_2)
33+
llm.do_liquid(liquid_request)
34+
liquid_request = LiquidRequest(LiquidType.LIQUID_2_4)
35+
llm.do_liquid(liquid_request)
36+
liquid_request = LiquidRequest(LiquidType.LIQUID_4_2)
37+
llm.do_liquid(liquid_request)
38+
liquid_request = LiquidRequest(LiquidType.LIQUID_2_1)
39+
llm.do_liquid(liquid_request)
4140

42-
output = llm.generate(inputs, sampling_params=sampling_params)
43-
print(f"output: {output[0].outputs[0].text}")
4441

45-
46-
liquid_request = LiquidRequest(LiquidType.LIQUID_4_2)
47-
llm.do_liquid(liquid_request)
48-
# liquid_request = LiquidRequest(LiquidType.LIQUID_2_1)
49-
# llm.do_liquid(liquid_request)
5042
output = llm.generate(inputs, sampling_params=sampling_params)
5143
print(f"output: {output[0].outputs[0].text}")
5244

0 commit comments

Comments
 (0)