-
Notifications
You must be signed in to change notification settings - Fork 59
/
kill-ryzen.sh
executable file
·77 lines (64 loc) · 2.12 KB
/
kill-ryzen.sh
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
#!/bin/bash
export LANG=C
USE_RAMDISK=true
CLEAN_ON_EXIT=false
NPROC=$1
TPROC=$2
[ -n "$NPROC" ] || NPROC=$(nproc)
[ -n "$TPROC" ] || TPROC=1
cleanup() {
sudo rm -rf /mnt/ramdisk/*
sudo umount /mnt/ramdisk
}
if $CLEAN_ON_EXIT; then
trap "cleanup" SIGHUP SIGINT SIGTERM EXIT
fi
echo "Install required packages"
if which apt-get &>/dev/null; then
sudo apt-get install build-essential
elif which dnf &>/dev/null; then
sudo dnf install -y @development-tools
else
exit 1
fi
if $USE_RAMDISK; then
echo "Create compressed ramdisk"
sudo mkdir -p /mnt/ramdisk || exit 1
sudo modprobe zram num_devices=1 || exit 1
echo 64G | sudo tee /sys/block/zram0/disksize || exit 1
sudo mkfs.ext4 -q -m 0 -b 4096 -O sparse_super -L zram /dev/zram0 || exit 1
sudo mount -o relatime,nosuid,discard /dev/zram0 /mnt/ramdisk/ || exit 1
sudo mkdir -p /mnt/ramdisk/workdir || exit 1
sudo chmod 777 /mnt/ramdisk/workdir || exit 1
cp buildloop.sh /mnt/ramdisk/workdir/buildloop.sh || exit 1
cd /mnt/ramdisk/workdir || exit 1
mkdir tmpdir || exit 1
export TMPDIR="$PWD/tmpdir"
fi
echo "Download GCC sources"
wget ftp://ftp.fu-berlin.de/unix/languages/gcc/releases/gcc-7.1.0/gcc-7.1.0.tar.bz2 || exit 1
echo "Extract GCC sources"
tar xf gcc-7.1.0.tar.bz2 || exit 1
echo "Download prerequisites"
(cd gcc-7.1.0/ && ./contrib/download_prerequisites)
[ -d 'buildloop.d' ] && rm -r 'buildloop.d'
mkdir -p buildloop.d || exit 1
echo "cat /proc/cpuinfo | grep -i -E \"(model name|microcode)\""
cat /proc/cpuinfo | grep -i -E "(model name|microcode)"
echo "sudo dmidecode -t memory | grep -i -E \"(rank|speed|part)\" | grep -v -i unknown"
sudo dmidecode -t memory | grep -i -E "(rank|speed|part)" | grep -v -i unknown
echo "uname -a"
uname -a
echo "cat /proc/sys/kernel/randomize_va_space"
cat /proc/sys/kernel/randomize_va_space
# start journal process in different working directory
pushd /
journalctl -kf | sed 's/^/[KERN] /' &
popd
echo "Using ${NPROC} parallel processes"
START=$(date +%s)
for ((I=0;$I<$NPROC;I++)); do
(./buildloop.sh "loop-$I" "$TPROC" || echo "TIME TO FAIL: $(($(date +%s)-${START})) s") | sed "s/^/\[loop-${I}\] /" &
sleep 1
done
wait