-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrunallocators
executable file
·102 lines (87 loc) · 3.13 KB
/
runallocators
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/sh -
exec=a.out
hostname=`hostname`
echo -n "======================\n${hostname}\n======================\n"
allocsdir="${HOME}/software/allocators"
allocators="libhoard.so libjemalloc.so libllheap.so libmimalloc.so libtbbmalloc.so libtcmalloc.so" # librpmalloc.so
cflag="-g -O3 -Wall -Wextra -D${hostname}" # -DLINEARAFF
if [ "${hostname}" = "algol" -o "${hostname}" = "prolog" ] ; then # ARM
# atomicinst=-mno-outline-atomics # use ARM LL/SC instructions for atomics
atomicinst=-march=armv8.2-a+lse # use ARM LSE instructions for atomics
cflag=${cflag}" ${atomicinst}"
fi
# select newest compiler available for OS
osversion=`lsb_release -sr`
if [ "${osversion}" = "24.04" ] ; then
CC=g++-14
elif [ "${osversion}" = "22.04" ] ; then
CC=g++-12
elif [ "${osversion}" = "20.04" ] ; then
CC=g++-10
else
echo "unknown operating system"
exit -1
fi
rm -rf core
# force initial thread to start on socket boundary
if [ "${hostname}" = "swift" ] ; then
taskset="taskset --cpu-list 128"
elif [ "${hostname}" = "java" ] ; then
taskset="taskset --cpu-list 0"
elif [ "${hostname}" = "prolog" ] ; then
taskset="taskset --cpu-list 0"
elif [ "${hostname}" = "algol" ] ; then
taskset="taskset --cpu-list 0"
elif [ "${hostname}" = "jax" ] ; then
taskset="taskset --cpu-list 24"
else
echo "unknown machine name"
exit -1
fi
#strace="strace -cfq"
time='/usr/bin/time -f "%Uu %Ss %Er %Mkb"'
#program="testgen"
program="ownership"
#program="larson"
larson() {
#args="5 8 1000 5000 100 4141" # https://github.com/daanx/mimalloc-bench/blob/master/bench.sh
args="30 16 4096 8096 100 4141"
echo -n "\nlarson arguments ${args}\n"
for CPU in 4 8 16 32 ; do
echo -n "larson procesors ${CPU}\n"
eval ${time} ${strace} ${taskset} ./${exec} ${args} ${CPU}
done
}
ownership() {
for CPU in 2 4 8 16 32 64 128 ; do
eval ${time} ${strace} ${taskset} ./${exec} 30 ${CPU} 100
done
}
echo -n "\n**********************\nglibc\n**********************\n\n"
echo -n "${CC} ${cflag} ${program}.cc -lpthread\n\n"
${CC} ${cflag} ${program}.cc -lpthread
echo -n "ldd\n" ; ldd ./${exec} ; echo -n "\n"
# kill pid for a.out to terminate
if [ "${program}" != "testgen" ] ; then
${program}
else
eval ${time} ${strace} ${taskset} ./${exec}
fi
for allocator in ${allocators} ; do
echo -n "\n**********************\n${allocator}\n**********************\n\n"
# compile without preload for checking => dynamic linking
# echo -n "${CC} ${cflag} ${program}.cc ${allocsdir}/${allocator} -lpthread -U malloc -Wl,-rpath=${allocsdir}\n\n"
# ${CC} ${cflag} ${program}.cc ${allocsdir}/${allocator} -lpthread -U malloc -Wl,-rpath=${allocsdir}
# echo -n "ldd\n" ; ldd ./${exec} ; echo -n "\n"
# compile with preload => dynamic linking
echo -n "${CC} ${cflag} ${program}.cc ${allocsdir}/${allocator} -lpthread\n\n"
${CC} ${cflag} ${program}.cc -lpthread ${allocsdir}/${allocator}
export LD_PRELOAD=${allocsdir}/${allocator}
# kill pid for a.out to terminate
if [ "${program}" != "testgen" ] ; then
eval ${program}
else
eval ${time} ${strace} ${taskset} ./${exec} ${args}
fi
done
rm -f "${exec}"