summaryrefslogtreecommitdiff
path: root/Microbenchmarks/CPU-DPU/run-alloc.sh
blob: 3ffd59ede4f1dede9f84f673a5aeaa8b18b3a199 (plain)
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash

NCORES=$(grep -c '^processor' /proc/cpuinfo)

cleanexit() {
	pkill -f "stress -c ${NCORES}"
	pkill -f mpstat
}

trap cleanexit TERM INT

set -e

mkdir -p $(hostname)-alloc
rm -f $(hostname)-alloc/*

for f in $(hostname)-alloc/idle.txt $(hostname)-alloc/stress-c${NCORES}.txt $(hostname)-alloc/nice-stress-c${NCORES}.txt; do
	echo "prim-benchmarks CPU-DPU alloc (dfatool edition)" >> $f
	echo "Started at $(date)" >> $f
	echo "Revision $(git describe --always)" >> $f
done

# runtime exclusive of host_code execution time: 25 seconds per inner loop
# *16  -> about 7 minutes per outer loop
# *163 -> about 18 hours total
for i in 1 2 4 8 16 32 48 64 80 96 112 $(seq 128 16 2542) 2542; do
	for j in $(seq 0 16); do
		echo $i/2542 $j/16
		./make-size.sh $j
		n_nops=$((j * 256))
		if make -B NR_DPUS=$i NR_TASKLETS=1 BL=10 DPU_BINARY=\'\"bin/dpu_size\"\'; then

			uptime
			S_TIME_FORMAT=ISO mpstat -P ALL -N ALL -n -o JSON 1 > $(hostname)-alloc/n_dpus=${i}-n_nops=${n_nops}.json &
			for l in $(seq 1 40); do
				bin/host_code -w 1 -e 0 -x 1 -i 65536 -N $n_nops >> $(hostname)-alloc/idle.txt || true
			done
			pkill -f mpstat

			stress -c ${NCORES} &
			sleep 2
			uptime
			for l in $(seq 1 40); do
				bin/host_code -w 1 -e 0 -x 1 -i 65536 -N $n_nops >> $(hostname)-alloc/stress-c${NCORES}.txt || true
			done
			pkill -f "stress -c ${NCORES}"

			sleep 10

			nice stress -c ${NCORES} &
			sleep 2
			uptime
			for l in $(seq 1 40); do
				bin/host_code -w 1 -e 0 -x 1 -i 65536 -N $n_nops >> $(hostname)-alloc/nice-stress-c${NCORES}.txt || true
			done
			pkill -f "stress -c ${NCORES}"

			sleep 10
		fi
	done
done

for f in $(hostname)-alloc/idle.txt $(hostname)-alloc/stress-c${NCORES}.txt $(hostname)-alloc/nice-stress-c${NCORES}.txt; do
	echo "Completed at $(date)" >> $f
done

for f in $(hostname)-alloc/idle.txt $(hostname)-alloc/stress-c${NCORES}.txt $(hostname)-alloc/nice-stress-c${NCORES}.txt; do
	xz -v -9 -M 800M $f
done