summarylogtreecommitdiffstats
path: root/auto-cpu-optimization.sh
blob: a86795ada77a336e21cfab3526ecc8ea3c718211 (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
#!/bin/bash
CPU=$(gcc -Q -march=native --help=target|grep march=|awk '{print $2}'|head -1)
MARCH=$(echo $CPU|tr '[:lower:]' '[:upper:]'&&echo)
if [[ ${MARCH} == "ZNVER" ]]; then
    MARCH="ZEN"
elif [[ ${MARCH} == "ZNVER2" ]]; then
    MARCH="ZEN2"
elif [[ ${MARCH} == "ZNVER3" ]]; then
    MARCH="ZEN3"
elif [[ ${MARCH} == "BDVER1" ]]; then
    MARCH="BULLDOZER"
elif [[ ${MARCH} == "BDVER2" ]]; then
    MARCH="PILEDRIVER"
elif [[ ${MARCH} == "BDVER3" ]]; then
    MARCH="STEAMROLLER"
elif [[ ${MARCH} == "BDVER4" ]]; then
    MARCH="EXCAVATOR"
elif [[ ${MARCH} == "BTVER1" ]]; then
    MARCH="BOBCAT"
elif [[ ${MARCH} == "BTVER2" ]]; then
    MARCH="JAGUAR"
elif [[ ${MARCH} == "AMDFAM10" ]]; then
    MARCH="MK10"
elif [[ ${MARCH} == "K8-SSE3" ]]; then
    MARCH="K8SSE3"
elif [[ ${MARCH} == "BONNELL" ]]; then
    MARCH="ATOM"
elif [[ ${MARCH} == "GOLDMONT-PLUS" ]]; then
    MARCH="GOLDMONTPLUS"
elif [[ ${MARCH} == "SKYLAKE-AVX512" ]]; then
    MARCH="SKYLAKE2"
elif [[ ${MARCH} == "ICELAKE-CLIENT" ]]; then
    MARCH="ICELAKE"
fi
MARCH2=M${MARCH}
echo
echo "----------------------------------"
echo "| APPLYING AUTO-CPU-OPTIMIZATION |"
echo "----------------------------------"
echo "[*] DETECTED CPU (MARCH) : ${MARCH2}"
scripts/config -k --disable CONFIG_GENERIC_CPU
scripts/config -k --enable CONFIG_${MARCH2}
sleep 3&&echo