Skip to content

Commit

Permalink
add more result
Browse files Browse the repository at this point in the history
  • Loading branch information
victoryang00 committed Mar 14, 2024
1 parent 1c49a37 commit b61a7d8
Show file tree
Hide file tree
Showing 12 changed files with 467 additions and 104 deletions.
49 changes: 41 additions & 8 deletions artifact/common_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,37 @@
import asyncio
import time

# pwd = "/Users/victoryang00/Documents/project/MVVM-bench/"
pwd = "/mnt/MVVM"
pwd = "/Users/victoryang00/Documents/project/MVVM-bench/"
# pwd = "/mnt/MVVM"
slowtier = "epyc"
burst = "mac"

def parse_time(time_string):
# Split the time string into components
components = time_string.split(":")
hours = int(components[0])
minutes = int(components[1])
seconds, milliseconds = map(int, components[2].split("."))

# Calculate the total seconds
total_seconds = hours * 3600 + minutes * 60 + seconds + milliseconds / 1000

return total_seconds


def parse_time_no_msec(time_string):
# Split the time string into components
components = time_string.split(":")
hours = int(components[0])
minutes = int(components[1])
seconds = int(components[2])

# Calculate the total seconds
total_seconds = hours * 3600 + minutes * 60 + seconds
if total_seconds < 10000:
print(time_string)
raise ValueError
return total_seconds

def get_func_index(func, file):
cmd = ["wasm2wat", "--enable-all", file]
Expand Down Expand Up @@ -363,6 +389,7 @@ def run_checkpoint_restore_slowtier(
f"script -q /dev/null -c 'ssh -t {slowtier} {pwd}/build/MVVM_restore -t {pwd}/build/bench/{aot_file1} {extra2}' >> MVVM_restore.1.out &"
)
os.system(f"ssh -t {slowtier} {pwd}/artifact/run_with_cpu_monitoring_nocommand.sh MVVM_restore &")
# print(f"ssh -t {slowtier} bash -c 'cd {pwd}/build && {pwd}/artifact/run_with_cpu_monitoring_nocommand.sh MVVM_restore' &")
os.system(
f"script -q /dev/null -c './MVVM_restore -t ./bench/{aot_file1} {extra3}' >> MVVM_restore.out &"
)
Expand All @@ -372,10 +399,10 @@ def run_checkpoint_restore_slowtier(
os.system(
f"../artifact/run_with_cpu_monitoring.sh ./MVVM_checkpoint -t ./bench/{aot_file1} {' '.join(['-a ' + str(x) for x in arg1])} -e {env} {extra1} &"
)
os.system("mv MVVM_checkpoint.out MVVM_checkpoint.1.out")
os.system("mv MVVM_checkpoint.ps.out MVVM_checkpoint.ps.1.out")
os.system("sleep 10")
os.system(f"pkill -SIGINT -f MVVM_checkpoint")
os.system("mv MVVM_checkpoint.out MVVM_checkpoint.1.out")
os.system("mv MVVM_checkpoint.ps.out MVVM_checkpoint.ps.1.out")
os.system(
f"../artifact/run_with_cpu_monitoring.sh ./MVVM_checkpoint -t ./bench/{aot_file} {' '.join(['-a ' + str(x) for x in arg])} -e {env}"
)
Expand All @@ -384,6 +411,7 @@ def run_checkpoint_restore_slowtier(
# print(checkpoint_result, restore_result)
# Return a combined result or just the checkpoint result as needed
os.system("sleep 100")
os.system(f"scp -r {slowtier}:{pwd}/build/MVVM_restore.ps.out ./MVVM_restore.ps.1.out")

cmd = f"cat ./MVVM_checkpoint.out ./MVVM_checkpoint.1.out ./MVVM_restore.1.out ./MVVM_restore.out"
cmd = cmd.split()
Expand All @@ -407,6 +435,11 @@ def run_checkpoint_restore_burst(
extra1: str = "",
extra2: str = "",
extra3: str = "",
extra4: str = "",
extra5: str = "",
extra6: str = "",
extra7: str = "",
extra8: str = "",
):
# Execute run_checkpoint and capture its result
res = []
Expand All @@ -416,7 +449,7 @@ def run_checkpoint_restore_burst(
os.system(
f"script -q /dev/null -c 'ssh -t {burst} {pwd}/build/MVVM_restore -t {pwd}/build/bench/{aot_file1} {extra2}' >> MVVM_restore.1.out &"
)
os.system(f"ssh -t {burst} ../artifact/run_with_energy_monitoring.sh MVVM_restore 1 &")
os.system(f"ssh -t {burst} bash -c ../artifact/run_with_energy_monitoring.sh MVVM_restore 1 &")
os.system(
f"script -q /dev/null -c './MVVM_restore -t ./bench/{aot_file1} {extra3}' >> MVVM_restore.out &"
)
Expand All @@ -431,10 +464,10 @@ def run_checkpoint_restore_burst(
os.system("sleep 10")
os.system(f"pkill -SIGINT -f MVVM_checkpoint")
os.system(
f"../artifact/run_with_energy_monitoring_mac.sh ./MVVM_checkpoint -t ./bench/{aot_file} {' '.join(['-a ' + str(x) for x in arg])} -e {env}"
)
f"../artifact/run_with_energy_monitoring_mac.sh ./MVVM_checkpoint -t ./bench/{aot_file} {' '.join(['-a ' + str(x) for x in arg])} -e {env} {extra4}"
) #redis
os.system(f"ssh -t {burst} pkill -SIGINT -f MVVM_restore")

os.system(f"")
# print(checkpoint_result, restore_result)
# Return a combined result or just the checkpoint result as needed
os.system("sleep 100")
Expand Down
Binary file modified artifact/result/optimistic.pdf
Binary file not shown.
5 changes: 5 additions & 0 deletions artifact/result/optimistic_computing.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name,fasttier,slowtier,snapshot Time
OMP_NUM_THREADS=1 bc.aot -g10 -n100000,22.031722,29.936722,0.00499
OMP_NUM_THREADS=1 bfs.aot -g10 -n1000000,72.930075,148.328455,0.004893
OMP_NUM_THREADS=1 bc.aot -g10 -n100000,21.618244,29.969255,0.005453
OMP_NUM_THREADS=1 bfs.aot -g10 -n1000000,74.279264,147.493264,0.004207
Binary file added artifact/result/optimistic_computing.pdf
Binary file not shown.
Binary file added artifact/result/optimistic_cpu.pdf
Binary file not shown.
Binary file added artifact/result/optimistic_memory.pdf
Binary file not shown.
14 changes: 4 additions & 10 deletions artifact/run_with_cpu_monitoring.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,19 @@
echo "$@"
"$@" &> $1.out &
pid1=$!
echo $pid1
# echo $pid > /sys/fs/cgroup/memory/my_cgroup/cgroup.procs
# echo $(($first_arg * 1024 * 1024 * 1024)) > /sys/fs/cgroup/memory/my_cgroup/memory.limit_in_bytes
date >> $1.ps.out
while true; do
line=$(ps auxh -q $pid1)
if [ "$line" == "" ]; then
break
fi
date >> $1.ps.out
echo $line >>$1.ps.out
for child in $(pgrep -P $pid1); do
line=$(ps auxh -q $child)
if [ "$line" == "" ]; then
continue
fi
date >> $1.ps.out
echo $line >>$1.ps.out
done
sleep 0.01
sleep 0.5
if ! ps -p $pid1 >/dev/null; then
sleep 0.5
exit 0
fi
done
8 changes: 5 additions & 3 deletions artifact/run_with_cpu_monitoring_nocommand.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
#!/bin/bash
echo "$@"
pid1=`ps aux | grep $1 | grep -v grep | awk '{print $2}'|tail -n 1`
pid1=`ps aux | grep $1 | grep -v grep | grep -v nocommand | grep -v ssh | awk '{print $2}'|head -n 1`
echo $pid1
sleep 2
# echo $pid > /sys/fs/cgroup/memory/my_cgroup/cgroup.procs
# echo $(($first_arg * 1024 * 1024 * 1024)) > /sys/fs/cgroup/memory/my_cgroup/memory.limit_in_bytes
date >> $1.ps.out
while true; do
line=$(ps auxh -q $pid1)
if [ "$line" == "" ]; then
break
fi
date >> $1.ps.out
echo $line >>$1.ps.out
sleep 0.01
sleep 0.5
if ! ps -p $pid1 >/dev/null; then
sleep 0.5
exit 0
fi
done
17 changes: 5 additions & 12 deletions artifact/run_with_energy_monitoring.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
#!/bin/bash
echo "$@"
pid1=`ps aux | grep $1 | grep -v grep | awk '{print $2}'|tail -n 1`
pid1=`ps aux | grep $1 | grep -v grep | awk '{print $2}'|head -n 1`
# echo $pid > /sys/fs/cgroup/memory/my_cgroup/cgroup.procs
# echo $(($first_arg * 1024 * 1024 * 1024)) > /sys/fs/cgroup/memory/my_cgroup/memory.limit_in_bytes
pcm-power 1 -m -1 &> $1.$2.energy.out &
pcm-power 1 -m -1 &> $1.energy.$2.out &
pid2=$!
date >> $1.ps.$2.out
while true; do
line=$(ps auxh -q $pid1)
if [ "$line" == "" ]; then
break
fi
date >> $1.$2.ps.out
echo $line >> $1.$2.ps.out
for child in $(pgrep -P $pid1); do
line=$(ps auxh -q $child)
if [ "$line" == "" ]; then
continue
fi
date >> $1.$2.ps.out
echo $line >> $1.$2.ps.out
done
echo $line >> $1.ps.$2.out
sleep 0.01
if ! ps -p $pid1 >/dev/null; then
sleep 0.5
sudo kill -9 $pid2
exit 0
fi
done
17 changes: 5 additions & 12 deletions artifact/run_with_energy_monitoring_mac.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
#!/bin/bash
echo "$@"
pid1=`ps aux | grep $1 | grep -v grep | awk '{print $2}'|tail -n 1`
pid1=`ps aux | grep $1 | grep -v grep | awk '{print $2}'|head -n 1`
# echo $pid > /sys/fs/cgroup/memory/my_cgroup/cgroup.procs
# echo $(($first_arg * 1024 * 1024 * 1024)) > /sys/fs/cgroup/memory/my_cgroup/memory.limit_in_bytes
sudo asitop --show_cores &> $1.$2.energy.out &
sudo asitop --show_cores &> $1.energy.$2.out &
pid2=$!
date >> $1.ps.$2.out
while true; do
line=$(ps auxh -q $pid1)
if [ "$line" == "" ]; then
break
fi
date >> $1.$2.ps.out
echo $line >> $1.$2.ps.out
for child in $(pgrep -P $pid1); do
line=$(ps auxh -q $child)
if [ "$line" == "" ]; then
continue
fi
date >> $1.$2.ps.out
echo $line >> $1.$2.ps.out
done
echo $line >> $1.ps.$2.out
sleep 0.01
if ! ps -p $pid1 >/dev/null; then
sleep 0.5
sudo kill -9 $pid2
exit 0
fi
done
Loading

0 comments on commit b61a7d8

Please sign in to comment.