git.iko.soy/xmrig-bash-scripts
on master help sign in
Merge pull request #4 from seanwhe/release/v1.0.3
e686255Sean Wheller
config.sh+1−1
@@ -14,7 +14,7 @@ _CPU_HUGE_PAGES="true"
14_CPU_HW_AES="$_AES_NI"
14_CPU_HW_AES="$_AES_NI"
15_CPU_PRIORITY="null"
15_CPU_PRIORITY="null"
16_CPU_ASM="true"
16_CPU_ASM="true"
17−_CPU_CN="0 1 2 3"
17+_CPU_CN="$_ENV_CPU_THREAD_AFFINITY"
18
18
19_CPU_CN_0="false"
19_CPU_CN_0="false"
20_CPU_CN_LITE_0="false"
20_CPU_CN_LITE_0="false"
settings.sh+43−10
@@ -11,7 +11,11 @@ _RECEIVE_WALLET="854sqm2Cm4TB2XgPHWqSPSbnFAe3SMzdEDzZHpukQ8NHBPFropbnkFmEKiZPgwj
11_POOL_SERVER_URL="192.168.4.5"
11_POOL_SERVER_URL="192.168.4.5"
12_POOL_SERVER_PORT="3333"
12_POOL_SERVER_PORT="3333"
13
13
14−#################################
14+#####################################################################
15+
16+# DO NOT CHANGE AFTER THIS POINT UNLESS YOU KNOW WHAT YOU ARE DOING
17+
18+#####################################################################
15
19
16# Set working directory
20# Set working directory
17_WORK_DIR="$(pwd)"
21_WORK_DIR="$(pwd)"
@@ -76,10 +80,48 @@ else
76 echo "$USER ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/README
80 echo "$USER ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/README
77fi
81fi
78
82
83+
84+# Check if CPU supports AES-NI
85+cpuid | grep -i aes > hw-aes.txt
86+if grep -q true "hw-aes.txt"; then
87+ _AES_NI=true
88+else
89+ _AES_NI=false
90+fi
91+rm hw-aes.txt
92+
79# Get number of available CPU Cores
93# Get number of available CPU Cores
80_ENV_CORE=$(nproc --all)
94_ENV_CORE=$(nproc --all)
81echo -e "CPU Cores: $_ENV_CORE\n"
95echo -e "CPU Cores: $_ENV_CORE\n"
82
96
97+# Get CPU L3 cache value
98+_ENV_CORE_L3=$(getconf LEVEL3_CACHE_SIZE)
99+echo -e "L3 Cache in byte: $_ENV_CORE_L3\n"
100+
101+# Determine number of threads possible
102+_ENV_CORE_L3_MB="$(($_ENV_CORE_L3 / 1000000))"
103+echo -e "L3 cache in Megabyte: $_ENV_CORE_L3_MB\n"
104+
105+# Determine number of threads possible
106+_ENV_CORE_THREADS="$(($_ENV_CORE_L3_MB / 2))"
107+echo "Each thread requires 2 MB of cache"
108+echo -e "Number of threads possible is: $_ENV_CORE_THREADS\n"
109+
110+# Affine number of threads for _CPU_CN
111+_COUNTER="$(($_ENV_CORE_THREADS - 1))"
112+_ENV_CPU_THREADS=()
113+
114+for i in `seq 0 $_COUNTER`; do
115+ _ENV_CPU_THREADS+=("$i")
116+done
117+
118+echo "Thread CPU Affinity: ${_ENV_CPU_THREADS[@]}"
119+
120+_ENV_CPU_THREAD_AFFINITY="${_ENV_CPU_THREADS[@]}"
121+
122+
123+# Setting according to cpu cores but xmrig will not use all
124+# change to make value use _ENV_CORE_THREADS
83# Check that hugepages set in /etc/sysctl.conf
125# Check that hugepages set in /etc/sysctl.conf
84_ENV_CHECK="nr_hugepages"
126_ENV_CHECK="nr_hugepages"
85
127
@@ -97,15 +139,6 @@ else
97 echo "vm.nr_hugepages=$_ENV_CORE" | sudo tee -a /etc/sysctl.conf
139 echo "vm.nr_hugepages=$_ENV_CORE" | sudo tee -a /etc/sysctl.conf
98fi
140fi
99
141
100−# Check if CPU supports AES-NI
101−cpuid | grep -i aes > hw-aes.txt
102−if grep -q true "hw-aes.txt"; then
103− _AES_NI=true
104−else
105− _AES_NI=false
106−fi
107−rm hw-aes.txt
108−
109# Run apt maintenance
142# Run apt maintenance
110# 1 = yes 0 = no
143# 1 = yes 0 = no
111_APT_MAINETANCE="1"
144_APT_MAINETANCE="1"