Skip to content

Commit

Permalink
gpu-detect corrected regex
Browse files Browse the repository at this point in the history
  • Loading branch information
dimafern committed Jun 5, 2018
1 parent 39b5be6 commit b8c2906
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
5 changes: 3 additions & 2 deletions hive/bin/hive
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
source /etc/environment
export PATH
export CUDA_DEVICE_ORDER
export HOME=/home/user #required by ccminer

#[ -t 1 ] &&
. colors #use them anyway
Expand Down Expand Up @@ -67,8 +68,8 @@ dos2unix-safe /hive-config/rig.conf

export GPU_COUNT_AMD=`gpu-detect AMD`
export GPU_COUNT_NVIDIA=`gpu-detect NVIDIA`
export GPU_FIRST_AMD=`lspci | grep -E "VGA|3D controller" | head -n 1 | grep AMD | wc -l`
export GPU_FIRST_NVIDIA=`lspci | grep -E "VGA|3D controller" | head -n 1 | grep NVIDIA | wc -l`
export GPU_FIRST_AMD=`gpu-detect AMD_FIRST`
export GPU_FIRST_NVIDIA=`gpu-detect NVIDIA_FIRST`

RIG_CONF="/hive-config/rig.conf"
AMD_OC_CONF="/hive-config/amd-oc.conf"
Expand Down
15 changes: 12 additions & 3 deletions hive/sbin/gpu-detect
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ if [[ $1 == "list" || $1 == "listjson" ]]; then

gpu_brand_i=-1
while read -r s; do
[[ -z $s ]] && continue
unset gputype
[[ $s =~ "NVIDIA" && ! $s =~ "nForce" ]] && gputype="NVIDIA" && COLOR=$GREEN && gpu_brand_i=$((gpu_brand_i+1))
[[ $s =~ "Advanced Micro Devices" ]] && gputype="AMD" && COLOR=$RED && gpu_brand_i=$((gpu_brand_i+1))
Expand Down Expand Up @@ -146,9 +147,17 @@ elif [[ $1 == "listnvidia" ]]; then
echo $s | sed -e "s/^00000000://" | sed -e "s/,\s/ /"
done <<<"$list"
exit 0
elif [[ $1 == "AMD" ]]; then
lspci | grep -E "VGA|3D controller" | grep "Advanced Micro Devices" | grep -v "RS880" | wc -l
elif [[ $1 == "AMD_FIRST" ]]; then
lspci | grep -E "VGA|3D controller" | head -n 1 | grep "Advanced Micro Devices" | grep -v "RS880" | wc -l
elif [[ $1 == "NVIDIA" ]]; then
lspci | grep -E "VGA|3D controller" | grep "NVIDIA" | grep -v "nForce" | wc -l
elif [[ $1 == "NVIDIA_FIRST" ]]; then
lspci | grep -E "VGA|3D controller" | head -n 1 | grep "NVIDIA" | grep -v "nForce" | wc -l
else
#default, just grep
lspci | grep -E "(VGA|3D controller).*$1" | wc -l
fi
#default, just grep
lspci | grep -E "(VGA|3D controller).*$1" | wc -l

0 comments on commit b8c2906

Please sign in to comment.