-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathms
executable file
·67 lines (48 loc) · 1.74 KB
/
ms
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
#!/bin/bash
################################################################################
### SCRIPT_DIR is the location the script
SCRIPT_DIR="`dirname \"$0\"`" # relative
SCRIPT_DIR="`( cd \"$SCRIPT_DIR\" && pwd )`" # absolutized and normalized
if [ -z "$SCRIPT_DIR" ] ; then
# error; for some reason, the path is not accessible
# to the script (e.g. permissions re-evaled after suid)
exit 1 # fail
fi
source $SCRIPT_DIR/FUNCTIONS
################################################################################
cd $MINER_PATH
settings_load
if [ "$1" = "-nofancy" ]; then
BOLD=""
BLUE=""
RED=""
NB=""
NC=""
fi
CURRENTLY_MINING=$LAST_COIN_MINED
PID=$(ps -ef | awk '/[m]iner/{print $2}')
if [ "$PID" = "" ]; then
UPTIME="-1"
else
UPTIME=$(echo $(ps -o etime= -p $PID) | xargs)
fi
printf "$($SCRIPT_DIR/mu)\n"
printf "System uptime :${BOLD}$(uptime)${NC}\n\n"
printf "#\tStatut\tUsage\tTemp\t Power / Power limit\tFan\t Name\n"
echo "---------------------------------------------------------------------------------------"
for GPU in $(seq 0 $((NB_GPUS-1))); do
GPUINFO=`nvidia-smi -i $GPU --query-gpu=utilization.gpu,temperature.gpu,power.draw,power.limit,fan.speed,name --format=csv,noheader`
UTIL=`nvidia-smi -i $GPU --query-gpu=utilization.gpu --format=csv,noheader | cut -f1 -d" "`
UTIL=$(echo $GPUINFO | cut -f1 -d " ")
TEMP=$(echo $GPUINFO | cut -f2 -d ",")
POWER=$(echo $GPUINFO | cut -f3 -d "," | cut -f2 -d " ")
POWER_SET=$(echo $GPUINFO | cut -f4 -d ",")
FAN=$(echo $GPUINFO | cut -f8 -d " ")
NAME=$(echo $GPUINFO | cut -f6 -d ",")
if (($UTIL < $IDLE_GPU)); then
printf "$GPU\t${RED}IDLE${NC}"
else
printf "$GPU\t${BOLD}OK${NC}"
fi
printf "\t$UTIL%%\t$TEMP C\t$POWER /$POWER_SET\t$FAN%%\t$NAME\n"
done