-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrunallocators
More file actions
executable file
·155 lines (131 loc) · 5.21 KB
/
runallocators
File metadata and controls
executable file
·155 lines (131 loc) · 5.21 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
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#!/bin/sh -
exec=a.out
hostname=`hostname`
echo -n "======================\n${hostname}\n======================"
arch=`uname -m`
if [ "${arch}" = "x86_64" ] ; then arch="x86-64"; fi # rpmalloc screws up here
if [ ${hostname} = "plg2" ] ; then
allocsdir="${HOME}/software/llheap"
allocators="libllheap.so"
else
# allocsdir="${HOME}/software/allocators"
allocsdir="${HOME}/software/mimalloc-bench/extern"
# allocators="glibc libhoard.so libjemalloc.so.2 libllheap.so libmimalloc.so.2 libtbbmalloc.so libtcmalloc.so" # librpmalloc.so
allocators="glibc dh/build/libdiehard.so ff/libffmallocnpmt.so hd/src/libhoard.so hm/out-light/libhardened_malloc-light.so iso/build/libisoalloc.so je/lib/libjemalloc.so ll/libllheap.so lp/Source/bmalloc/libpas/build-cmake-default/Release/libpas_lib.so lt/gnu.make.lib/libltalloc.so mesh/build/lib/libmesh.so mi3/out/release/libmimalloc.so mng/libmallocng.so rp/bin/linux/release/${arch}/librpmalloc.so scudo/compiler-rt/lib/scudo/standalone/libscudo.so sn/release/libsnmallocshim.so tbb/bench_release/libtbbmalloc_proxy.so tc/.libs/libtcmalloc_minimal.so yal/yalloc.so"
# allocators="ll/libllheap-stats.so"
fi
cflag="-g -O3 -Wall -Wextra -DNDEBUG -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
# force initial thread to start on socket boundary
if [ "${hostname}" = "swift" -o "${hostname}" = "plg2" ] ; then
# taskset="taskset --cpu-list 128-256" # upper socket
taskset=
elif [ "${hostname}" = "java" ] ; then
taskset=
elif [ "${hostname}" = "prolog" ] ; then
taskset=
elif [ "${hostname}" = "algol" ] ; then
taskset=
else
echo -n "\nUsage error unknown machine name "${hostname}."\n"
exit 1
fi
#strace='strace -cfq'
time='/usr/bin/time -f "%Uu %Ss %er %Mkb"'
#perf='perf stat -B -e cache-references,cache-misses'
#timeout='timeout -k 1 3600'
#program="check_sticky"
#program="check_header"
#program="check_alignment"
#program="check_badalloc"
#program="larson"
#program="ownership"
#program="cache"
program="latency"
check_sticky() {
eval ${time} ${strace} ${timeout} ${taskset} ${perf} ./${exec}
}
check_alignment() {
eval ${time} ${strace} ${timeout} ${taskset} ${perf} ./${exec}
}
check_header() {
eval ${time} ${strace} ${timeout} ${taskset} ${perf} ./${exec}
}
check_badalloc() {
ulimit -d 1000000
eval ${time} ${strace} ${perf} ${taskset} timeout -k 1 10 ./${exec}
}
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} ${perf} ${taskset} ${timeout} ./${exec} ${args} ${CPU}
done
}
ownership() {
for CPU in 2 4 8 16 32 64 128 ; do
eval ${time} ${strace} ${perf} ${taskset} ${timeout} ./${exec} 30 ${CPU} 100
done
}
cache() {
${CC} ${cflag} -DCONTIG ${program}.cc
eval ${time} ${strace} ${timeout} ${taskset} ./${exec} ${args} 10000
${CC} ${cflag} ${program}.cc
eval ${time} ${strace} ${timeout} ${taskset} ${perf} ./${exec} ${args} 10000 16 16 d 100000
${CC} ${cflag} ${program}.cc
eval ${time} ${strace} ${timeout} ${taskset} ${perf} ./${exec} ${args} 10000
${CC} ${cflag} -DCONTIG -DFREE ${program}.cc
eval ${time} ${strace} ${timeout} ${taskset} ./${exec} ${args} 10000
${CC} ${cflag} -DFREE ${program}.cc
eval ${time} ${strace} ${timeout} ${taskset} ${perf} ./${exec} ${args} 10000 16 16 d 100000
${CC} ${cflag} -DFREE ${program}.cc
eval ${time} ${strace} ${timeout} ${taskset} ${perf} ./${exec} ${args} 10000
}
latency() {
eval ${time} ${strace} ${timeout} ${taskset} ${perf} ./${exec} ${args}
}
for allocator in ${allocators} ; do
allocatorname=`echo ${allocator} | sed -e "s@\([a-zA-Z0-9]*\)/.*.so@\1@"`
echo -n "\n${allocatorname}\n"
# compile without preload for checking => dynamic linking
# if [ "${allocator}" = "glibc" ] ; then
# # echo -n "${CC} ${cflag} ${program}.cc -lpthread\n\n"
# ${CC} ${cflag} ${program}.cc -lpthread
# else
# # 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}
# fi
# compile with preload => dynamic linking
#echo "${CC} ${cflag} ${program}.cc -lpthread"
${CC} ${cflag} ${program}.cc -lpthread
#echo -n "ldd\n" ; ldd ./${exec} ; echo -n "\n"
if [ "${allocator}" != "glibc" ] ; then
export LD_PRELOAD=${allocsdir}/${allocator}
#echo "${LD_PRELOAD}"
fi
eval ${program}
if [ "${allocator}" != "glibc" ] ; then # turn off allocator as some fail in shell
unset LD_PRELOAD
fi
done
rm -f core
rm -f "${exec}"
exit 0