-
Notifications
You must be signed in to change notification settings - Fork 23
/
nvOC
executable file
·1126 lines (1010 loc) · 37.9 KB
/
nvOC
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
################################################################################
# #
# nvOC #
# #
# Purpose: Handles a variety of tasks for the nvOC mining operating system #
# including stop and start mining, patching, etc #
# #
# Usage: See echo_usage (below) #
# #
# #
################################################################################
#
# Dev Mod Log:
#
# v=0001 : Stubo:
# Initial Revision
#
# v=0002 : papampi
# changes to clearlogs and stop
#
# v=0003 : Stubo
# removed help
# removed > /dev/null 2>&1 from 5watchdog line in stop
#
# v=0004 : leenoox
# added gpumap
# added report
# added Text output beautifier
# applied "bleed" fix
# added version, export DISPLAY, source 1bash, added PNY and PALIT PCI ID's
#
# v=0005 : papampi
# added miner-log, wdog-log, temp-log, wtm-log, master-log
#
# v=0006 : Stubo
# changed calls of other external functions to internal subroutine calls
# papampi
# added wtm_auto_switch version
#
# v=0007 : papampi
# Changed ~/1bash to /home/m1/1bash for known reasons ...
#
# v=0008 : LukePicci
# Relocate nvOC to arbitrary install directory
#
# v=0009 : LuKePicci
# added main-log, install- start- and stop-service
# v=0010 : papampi
# Detailed OC,PL report, some more fixes for 19-2.1
# v=0011 : LuKePicci
# Git repo and submodules status report
# v=0012 : LuKePicci
# cuda version, service status, upgrade cmdlets
export DISPLAY=:0
export NVOC="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source ${NVOC}/1bash
source ${NVOC}/helpers/coin_algo_mapping
nvOC_nvOC_Dev="0012"
nvOC_nvOC_ver="$nvOC_Ver.$nvOC_nvOC_Dev" # Do not edit this
# Text output beautifier, use bold text and colors
USE_COLOR="YES" # YES/NO
if [[ $USE_COLOR == YES ]]
then
N='\e[0m' # Normal
B='\e[1m' # Bold
R='\e[31m' # Red
G='\e[32m' # Green
C='\e[36m' # Cyan
Y='\e[33m' # Yellow
else
unset N B R G C Y
fi
################################################################################
# Subroutines
################################################################################
############################ Display Help on Usage #############################
echo_usage()
{
echo ""
echo -e "${B}Usage:${N} ${C}$0 clearlogs${N}"
echo " clears out OS & nvOC logs"
echo -e " ${C}$0 gpuinfo${N}"
echo " displays GPU ID, infomation, settings, and status"
echo -e " ${C}$0 gpumap${N}"
echo " physically map (locate) your GPU's"
echo -e " ${C}$0 report${N}"
echo " create report about hardware and nvOC relevant settings"
echo -e " ${C}$0 restore${N}"
echo " restore nvOC files to their unmodified version"
echo -e " ${C}$0 upgrade${N}"
echo " upgrade to latest nvOC revision for your current branch"
echo -e " ${C}$0 miners-upgrade${N}"
echo " upgrade nvOC miners collection with latest changes and intall them"
echo -e " ${C}$0 reboot${N}"
echo " reboots the host machine"
echo -e " ${C}$0 stop${N}"
echo " stops mining, watchdog and temperature control"
echo -e " ${C}$0 start${N}"
echo " starts normal nvOC mining operations"
echo -e " ${C}$0 restart${N}"
echo " restart nvOC mining operations"
echo -e " ${C}$0 install-service${N}"
echo " (re)install nvOC service for this nvOC tree"
echo -e " ${C}$0 start-service${N}"
echo " manually start the nvOC service"
echo -e " ${C}$0 stop-service${N}"
echo " stop the running nvOC service"
echo -e " ${C}$0 main-log${N}"
echo " display nvOC startup output (Only for nvOC running as a service)"
echo -e " ${C}$0 miner-log${N}"
echo " display live miner output"
echo -e " ${C}$0 cpuminer-log${N}"
echo " display live cpuminer output"
echo -e " ${C}$0 wdog-log${N}"
echo " display live watchdog output (Only for REMOTE)"
echo -e " ${C}$0 temp-log${N}"
echo " display live temp control output (Only for REMOTE)"
echo -e " ${C}$0 wtm-log${N}"
echo " display live wtm auto switch output"
echo -e " ${C}$0 master-log${N}"
echo " display live miner, watchdog, temp control and wtm auto switch output"
echo -e " ${C}$0 restore-xorg${N}"
echo " Restore default nvOC xorg.conf"
}
################################# Clearlogs ######################################
Clearlogs()
{
echo -e "${B}Clearing logs...${N}"
# Must become root to clear these logs
sudo su -c "> /var/log/auth.log"
sudo su -c "> /var/log/dpkg.log"
sudo su -c "> /var/log/syslog"
sudo su -c "> /var/log/Xorg.0.log"
sudo su -c "> /var/log/kern.log"
echo > ${NVOC}/5_watchdoglog
echo > ${NVOC}/6_autotemplog
echo > ${NVOC}/current-profit
echo > ${NVOC}/algo-log
rm -r ${NVOC}/kk003_telegram_data > /dev/null 2>&1
echo; echo "...done."
}
################################# GPU Info ######################################
GPUinfo()
{
# Get device IDs
DEVICE_IDS=$(nvidia-smi --query-gpu=pci.sub_device_id --format=csv,noheader,nounits)
i=0
echo ""
INFO+="${B}ID,|,PS,|,T°,|,FAN,|,LOAD,|,POWER / LIMIT / MAX,|,GPUCLOCK,|,MEMCLOCK,|,VENDOR - MODEL\n"
for ID in $DEVICE_IDS
do
# Get vendor id substring
VENDOR_ID=${ID:6:5}
# GPU Query, 3842=EVGA, 1462=MSI, 10DE=Nvidia, 19DA=Zotac, 807D=Asus, 1458=Gigabyte
case $VENDOR_ID in
3842) VENDOR_ID="EVGA";;
1462) VENDOR_ID="MSI";;
10DE) VENDOR_ID="NVIDIA";;
19DA) VENDOR_ID="ZOTAC";;
807D|1043) VENDOR_ID="ASUS";;
1458) VENDOR_ID="GIGABYTE";;
196E) VENDOR_ID="PNY";;
1569) VENDOR_ID="PALIT";;
esac
# Get most GPU info here
{ IFS=', ' read PSTATE CURRENT_TEMP CURRENT_FAN UTILIZATION PWRLIMIT POWERDRAW; } < <(nvidia-smi -i $i --query-gpu=pstate,temperature.gpu,fan.speed,utilization.gpu,power.limit,power.draw --format=csv,noheader,nounits)
# Some GPU info requires special tactics
MODEL=$(nvidia-smi -i $i --query-gpu=name --format=csv,noheader,nounits | tail -1)
POWERMAX=$(nvidia-smi -i $i -q|grep "Max Power"|cut -f 2 -d ":"|cut -f 2 -d " ")
GPUCLOCK=$(nvidia-smi -i $i -q -d CLOCK |grep Graphics |head -1|cut -f 2 -d ":"|cut -f 2 -d " ")
MEMCLOCK=$(nvidia-smi -i $i -q -d CLOCK |grep Memory |head -1|cut -f 2 -d ":"|cut -f 2 -d " ")
# convert power values to integer
POWERDRAW=$(echo "$POWERDRAW/1" | bc)
PWRLIMIT=$(echo "$PWRLIMIT/1" | bc)
POWERMAX=$(echo "$PWRLIMIT/1" | bc)
# Memory clock display on Nvidia X Server Settings is doubled
# uncomment this line if you want it displayed that way
# MEMCLOCK=$(($MEMCLOCK * 2))
INFO+="$N$i,|,$PSTATE,|,$CURRENT_TEMP,|,$CURRENT_FAN,|,$UTILIZATION,|,$POWERDRAW / $PWRLIMIT / $POWERMAX,|,$GPUCLOCK,|,$MEMCLOCK,|,$VENDOR_ID - $MODEL\n"
(( i++ ))
done
echo -e $INFO | column -t -s,
}
############################### Reboot host ###################################
Reboot()
{
# Reboots the host
echo -e "${B}${R}Warning: The host will reboot in 10 seconds, ctrl-c to cancel...${N}"
sleep 10
sudo su -c "shutdown -r now"
}
############################### Start nvOC in gnome-terminal ##################
StartGnomeTerminal()
{
if [[ $LOCALorREMOTE == REMOTE ]]
then
export DISPLAY=:0
fi
if ps ax | grep -q "[g]nome-terminal"
then
echo "nvOC already running, use ./nvOC restart"
else
echo -e "${B}Restarting nvOC tasks....${N}"; echo
gnome-terminal --window-with-profile=mining
fi
}
############################### Stop nvOC in gnome-terminal ###################
StopGnomeTerminal()
{
echo -e "${B}Stopping nvOC processes...${N}"; echo
# Kill off the nv_OC processes
pkill -ef gnome-terminal
pkill -ef 5watchdog
pkill -ef 7telegram
pkill -ef 6tempcontrol
pkill -ef 8wtm
pkill -ef screenrc
echo; echo "...done."
}
############################### Restart Miner ##################################
Restart()
{
# Restart nvOC from scratch
if systemctl is-enabled nvoc.service
then
# nvOC as systemd service
StopService && StartService
else
# nvOC in gnome-terminal
StopGnomeTerminal && StartGnomeTerminal
fi
}
############################### gpumap ########################################
GPUmap()
{
# gpumap for nvOC v0019-2.0 by leenoox
#
# Ever wondered which physical video card is assigned as GPU2 or GPU6?
# Troubleshooting nightmares? Your watchdog reported that GPU7 failed
# of the bus. How do you know which physical card is assigned as GPU7?
#
# Here is an ingenious way to determine physical location of the GPU's.
#
# When executed, first, it will stop all mining processes and turn all
# GPU fans OFF (and turn GPU Logo LED lights OFF if supported by your GPU's).
#
# Then it will turn only GPU0 fan ON (and light if supported) allowing you
# to physically map which one is GPU0 by simply looking at which fan is spinning.
# By pressing "y" button, it will turn GPU0 OFF and move on to the next GPU.
# It will turn GPU fans ON then OFF, one by one until the last GPU is reached.
#
# When finished, it will resume your mining process.
#
# Please note, due to driver limitation, LED lights can not be controlled
# on each and every available model. Do not report this as bug ;)
nvOC_gpumap_ver="v0019-2.0.002" # Do not edit this
NVD=nvidia-settings
# Check if CUDA_DEVICE_ORDER=PCI_BUS_ID is set
CUDA_ORDER="/etc/profile.d/cuda-device-order.sh"
if [[ -e "$CUDA_ORDER" ]]
then
if (( $(wc -l <$CUDA_ORDER) > 1 ))
then
echo
echo "Fixing the CUDA_DEVICE_ORDER=PCI_BUS_ID"
sudo rm $CUDA_ORDER
sudo echo 'export CUDA_DEVICE_ORDER=PCI_BUS_ID' | sudo tee -a /etc/profile.d/cuda-device-order.sh
fi
else
echo "Setting the 'export CUDA_DEVICE_ORDER=PCI_BUS_ID'"
echo "in order to properly map GPU's"
echo "Please reboot for the changes to take effect"
sudo echo 'export CUDA_DEVICE_ORDER=PCI_BUS_ID' | sudo tee -a /etc/profile.d/cuda-device-order.sh
echo
exit
fi
# Determine the number of available GPU's
GPUS=$(nvidia-smi -i 0 --query-gpu=count --format=csv,noheader,nounits)
count=0
# Display version info
echo; echo
for i in {16..21}
do
echo -en "\e[48;5;${i}m "
done
echo -en "${B}gpumap $nvOC_gpumap_ver by leenoox${N}"
for i in {21..16}
do
echo -en "\e[48;5;${i}m \e[0m"
done
echo; echo; echo
sleep 0.5
echo -e "${B}gpumap${N} will help you physically map your GPU's by spinning single"
echo -e "GPU fan(s) only, one at a time and turning LED lights ON (if supported)."
echo -e "It will also show some info about the GPU. Please follow prompts."
echo; echo
echo -e "${B}gpumap${N} has detected: ${B}$GPUS${N} GPU's"
echo; echo
echo -e "${Y}To continue we have to temporary stop all mining processes."
echo -e "Once finished, mining processes will resume.${N}${B}"
echo
read -r -n 1 -p "Continue (y/n)? " response
echo -e "${N}"; echo
if [[ $response =~ ^[Yy]$ ]]
then
echo -e "${Y}Stopping nvOC processes...${N}"
# Kill off the nv_OC processes
Stop
echo
echo "... done!"
echo; echo
echo -e "${Y}Turning all fans and LED lights OFF...${N}"
echo
# Turn everything OFF
while (( count < GPUS ))
do
${NVD} -a [gpu:${count}]/GPUFanControlState=1 >/dev/null 2>&1
${NVD} -a [fan:${count}]/GPUTargetFanSpeed=0 >/dev/null 2>&1
${NVD} -a [gpu:${count}]/GPULogoBrightness=0 >/dev/null 2>&1
(( count++ ))
done
echo "... done!"
echo; echo
count=0
# Turn fan/LED ON - one GPU at a time
while (( count < GPUS ))
do
${NVD} -a [fan:${count}]/GPUTargetFanSpeed=75 >/dev/null 2>&1
${NVD} -a [gpu:${count}]/GPULogoBrightness=100 >/dev/null 2>&1
echo -e "${Y}Take a look at your rig for spinning fan now${N}"
echo
echo -e "${B}GPU$count${N} fan and LED are ON. This is your ${B}GPU$count${N}."
echo
# Stubo's Vendor detection
ID=$(nvidia-smi -i $count --query-gpu=pci.sub_device_id --format=csv,noheader,nounits)
VENDOR_ID=${ID:6:4}
case $VENDOR_ID in
3842) VENDOR_ID="EVGA";;
1462) VENDOR_ID="MSI";;
10DE) VENDOR_ID="NVIDIA";;
19DA) VENDOR_ID="ZOTAC";;
807D|1043) VENDOR_ID="ASUS";;
1458) VENDOR_ID="GIGABYTE";;
196E) VENDOR_ID="PNY";;
1569) VENDOR_ID="PALIT";;
esac
MODEL=$(nvidia-smi -i $count --query-gpu=name --format=csv,noheader,nounits | tail -1)
POWERMAX=$(nvidia-smi -i $count -q|grep "Max Power"|cut -f 2 -d ":"|cut -f 2 -d " ")
POWERMIN=$(nvidia-smi -i $count -q|grep "Min Power"|cut -f 2 -d ":"|cut -f 2 -d " ")
SLOWDOWN=$(nvidia-smi -i $count -q|grep "Slowdown Temp"|cut -f 2 -d ":"|cut -f 2 -d " ")
SHUTDOWN=$(nvidia-smi -i $count -q|grep "Shutdown Temp"|cut -f 2 -d ":"|cut -f 2 -d " ")
BUSID=$(nvidia-smi -i $count -q|grep "Bus Id"|cut -f 2- -d ":"|cut -f 2- -d " ")
echo -e "${B}GPU$count info:${N}"
echo "$VENDOR_ID $MODEL"
echo "Bus ID: $BUSID"
echo "Min Power Limit: $POWERMIN"
echo "Max Power Limit: $POWERMAX"
echo "GPU Slowdown Temp: $SLOWDOWN"
echo "GPU Shutdown Temp: $SHUTDOWN"
echo
echo
# Move on to the next GPU
echo -e "${B}"
read -r -n 1 -p "Continue (y/n)? " response
echo -e "${N}"; echo
if [[ $response =~ ^[Yy]$ ]]
then
${NVD} -a [fan:${count}]/GPUTargetFanSpeed=0 >/dev/null 2>&1
${NVD} -a [gpu:${count}]/GPULogoBrightness=0 >/dev/null 2>&1
elif [[ $response =~ ^[Nn]$ ]]
then
${NVD} -a [fan:${count}]/GPUTargetFanSpeed=0 >/dev/null 2>&1
${NVD} -a [gpu:${count}]/GPULogoBrightness=0 >/dev/null 2>&1
echo -e "Acknowledged. Thank you for using ${B}gpumap${N}"
echo "Resuming mining operation now..."
echo ""
Restart
else
echo "Neither y or n were pressed!"
echo "Lets try this again..."
read -r -n 1 -p "Continue (y/n)? " response
echo -e "${N}"; echo ""
if [[ $response =~ ^[Yy]$ ]]
then
${NVD} -a [fan:${count}]/GPUTargetFanSpeed=0 >/dev/null 2>&1
${NVD} -a [gpu:${count}]/GPULogoBrightness=0 >/dev/null 2>&1
else
echo "Neither y or n were pressed again!"
${NVD} -a [fan:${count}]/GPUTargetFanSpeed=0 >/dev/null 2>&1
${NVD} -a [gpu:${count}]/GPULogoBrightness=0 >/dev/null 2>&1
echo -e "Thank you for using ${B}gpumap${N}"
echo "Resuming mining operation now."
Restart
fi
fi
echo; echo
(( count++ ))
done
else
exit
fi
echo -e "${Y}All done, that was the last detected GPU.${N}"
echo; echo
echo -e "Thank you for using ${B}gpumap${N}"
echo
read -r -p "Resume mining operation now? (y/n + enter): " response
echo -e "${N}"; echo ""
if [[ $response =~ ^[Yy]$ ]]
then
Restart
fi
}
############################### report ########################################
Report()
{
# DEV_VERSION=002
# Last edit by: leenoox
# Status: incomplete
# Report generator for nvOC v0019-2.0 - Community Release
# Report generator by leenoox
#
# The Report function gathers hardware and software information, system settings,
# as well as the relevant settings info from the nvOC settings file, 1bash.
# It gives an overview of the most important aspects of your rig.
#
# The generated Report can be copied and posted on the official nvOC bitcointalk.org
# forum and will help with the request for troubleshooting, or simply post a standard
# generated Report when one is needed.
#
# To generate the report simply run:
# ./nvOC report
#
# then copy everything including the [code] and [/code] tags and post on bitcointalk.org
# This comment section to be removed in the final script
# Tested on:
# (8 core) - Core(TM) i7-7700 CPU @ 3.60GHz
# (4 core) - Core(TM) i5-3570 CPU @ 3.40GHz
# (2 core) - Celeron(R) CPU G3930 @ 2.90GHz
# MB: ASRock H110 Pro BTC+
# MB: ASUS PRIME Z270-A Rev 1.xx
# MB: ASUS P8Z77-V LK Rev X.0x
#
# TODO
# * Check if internet connection is up
# * Check if CUDA_DEVICE_ORDER is set
# * finish collection of data from whole 1bash (currently about 80%)
# * add alias to .bashrc
# * function to clean/replace any string matching the array, eg. AsusTek to Asus. Intel Corp. to Intel
# * way to determine exact number of cores and threads, right now cores+threads are
# reported together as a single number
# * Works well on older version, not fully compatible with 19-2, need to change few queries, eg. nvOC version,
# change new naming scheme for watchdog, temp control...
REPORT_VER="$nvOC_nvOC_ver"
clear
# Display version info
echo
for i in {16..21}
do
echo -en "\e[48;5;${i}m "
done
echo -en "${B}Report generator for nvOC $nvOC_Ver v$nvOC_nvOC_Dev ${N}"
for i in {21..16}
do
echo -en "\e[48;5;${i}m \e[0m"
done
echo
echo
# Collect info and ssign to variables
#######################################
nvidia_driver_ver=$(nvidia-smi -i 0 -q|grep "Driver Version"|cut -f 2 -d ":"|cut -f 2 -d " ")
nvOC_ver_from_1bash=$(cat ${NVOC}/1bash | grep nvOC_Ver| sed 's/^.*="v//' | sed 's/\"//');
nvOC_1bash_temp_ver=$(cat ${NVOC}/1bash.template | grep nvOC_1bash_ver= | sed 's/nvOC_1bash_ver=//' | sed 's/\"//' | sed 's/\"//' )
nvOC_3main_ver=$(head -n 100 ${NVOC}/3main | grep nvOC_3main_Dev= | sed 's/nvOC_3main_Dev=//' | sed 's/\"//' | sed 's/\"//' )
nvOC_wdog_ver=$(head -n 100 ${NVOC}/5watchdog | grep nvOC_wdog_Dev= | sed 's/nvOC_wdog_Dev=//' | sed 's/\"//' | sed 's/\"//')
nvOC_temp_ver=$(head -n 100 ${NVOC}/6tempcontrol | grep nvOC_temp_Dev= | sed 's/nvOC_temp_Dev=//' | sed 's/\"//' | sed 's/\"//' )
nvOC_wtm_ver=$( head -n 100 ${NVOC}/8wtm_auto_switch | grep wtm_auto_switch_Dev= | sed 's/wtm_auto_switch_Dev=//' | sed 's/\"//' | sed 's/\"//')
nvOC_wtm_p_ver=$( head -n 100 ${NVOC}/8wtm_profit_check | grep wtm_profit_check_Dev= | sed 's/wtm_profit_check_Dev=//' | sed 's/\"//' | sed 's/\"//')
nvOC_pools_switch_ver=$( head -n 100 ${NVOC}/9poolswitch | grep nvOC_poolswitch_Dev= | sed 's/nvOC_poolswitch_Dev=//' | sed 's/\"//' | sed 's/\"//')
nvOC_minerinfo_ver=$( head -n 100 ${NVOC}/www/cgi-bin/minerinfo | grep nvOC_minerinfo_Dev= | sed 's/nvOC_minerinfo_Dev=//' | sed 's/\"//' | sed 's/\"//')
kernel=$(cat /proc/version | cut -d' ' -f 3);
# os_release=$(cat /usr/lib/os-release | grep PRETTY_NAME | sed 's/PRETTY_NAME=\"//' | sed 's/\"//');
# os_release=$(cat /etc/lsb-release | grep DISTRIB_DESCRIPTION | sed 's/DISTRIB_DESCRIPTION=\"//' | sed 's/\"//');
os_release=$(cat /etc/issue.net)
system=$(cat /proc/version | cut -d' ' -f 5,7,9,10);
mbvendor=$(cat /sys/devices/virtual/dmi/id/board_vendor);
mbmodel=$(cat /sys/devices/virtual/dmi/id/board_name);
mbversion=$(cat /sys/devices/virtual/dmi/id/board_version);
biosver=$(cat /sys/devices/virtual/dmi/id/bios_version);
biosdate=$(cat /sys/devices/virtual/dmi/id/bios_date);
cpu=$(cat /proc/cpuinfo | grep -m 1 "model name" | cut -d' ' -f 4-);
cores=$(cat /proc/cpuinfo | grep "model name" | wc -l);
memtotal=$(cat /proc/meminfo | grep MemTotal | cut -d' ' -f 2-);
memfree=$(cat /proc/meminfo | grep MemFree | cut -d' ' -f 2-);
swaptotal=$(cat /proc/meminfo | grep SwapTotal | cut -d' ' -f 2-);
swapfree=$(cat /proc/meminfo | grep SwapFree | cut -d' ' -f 2-);
ethernet=$(lspci | grep Ethernet | cut -d' ' -f 4-);
# Replace strings for better output:
# (Motherboard) replace: "ASUSTeK COMPUTER INC." with "ASUS"
# (Ethernet) replace: "Realtek Semiconductor Co., Ltd." with "Realtek"
# (Ethernet) replace: "Intel Corporation Ethernet Connection (2)" with "Intel"
# if echo "$mbvendor" | grep -q "ASUSTeK" ; then mbvendor="ASUS"; fi
if [[ $mbvendor == ASUSTeK* ]]
then
mbvendor="ASUS"
fi
if echo "$ethernet" | grep -q "Realtek"
then
ethernet=$( echo $ethernet | sed 's/Realtek Semiconductor Co., Ltd./Realtek/g' )
elif
echo "$ethernet" | grep -q "Intel"
then
ethernet=$( echo $ethernet | sed 's/Intel Corporation Ethernet Connection (2)/Intel/g' )
fi
#######################################
# Output on screen
#######################################
echo
echo "[code]"
echo -e \
"
${B}Operating System info:${N}
Kernel : $kernel
OS : $os_release
System : $system
nvidia driver : $nvidia_driver_ver
${B}nvOC info:${N}
nvOC path : ${NVOC}
nvOC : $nvOC_ver_from_1bash
Report : $nvOC_nvOC_Dev
1bash : $nvOC_1bash_ver
1bash.template: $nvOC_1bash_temp_ver
3main : $nvOC_3main_ver
5watchdog : $nvOC_wdog_ver
6tempcontrol : $nvOC_temp_ver
wtm switch : $nvOC_wtm_ver
wtm profit : $nvOC_wtm_p_ver
pool switch : $nvOC_pools_switch_ver
minerinfo : $nvOC_minerinfo_ver
${B}Hardware info:${N}
Motherboard : $mbvendor $mbmodel $mbversion
BIOS ver. : $biosver $biosdate
CPU Model : $cpu
CPU Cores : $cores (Cores + Threads)
Mem Total : $memtotal
Mem Free : $memfree
Swap Total : $swaptotal
Swap Free : $swapfree
Ethernet : $ethernet"
echo
# CUDA
#######################################
echo -e "${B}CUDA SDK version${N}"
echo "nvcc path : $(which nvcc)"
nvcc --version
echo
# nvoc.service
#######################################
if [[ -e /etc/systemd/system/nvoc.service ]]
then
echo -e "${B}nvoc.service systemd's log${N}"
service nvoc status | cat
else
echo "nvOC is not installed as a service"
fi
echo
# HDD
#######################################
echo -e "${B}HDD and Partion info:${N}"
# df -H
# sudo fdisk -l -L=never | grep dev
lsblk -o name,size,fstype,type,rota,hotplug,tran,vendor,model,rev,mountpoint
echo
# VGA
#######################################
echo -e "${B}VGA info:${N}"
lspci | grep VGA
echo
# Git
#######################################
echo -e "${B}Local git branch and submodules status:${N}"
git -C ${NVOC} status -s -b -uno --ignore-submodules=all
git -C ${NVOC} submodule status
git -C ${NVOC}/miners status -s -b -uno --ignore-submodules=all
git -C ${NVOC}/miners submodule status
echo
# 1bash settings
#######################################
echo -e "${B}1bash settings:${N}"
# 1bash general
echo "1bash version .............: $nvOC_1bash_ver" # for pre 19.2 versions use $(cat ${NVOC}/1bash | grep "nvOC v" | cut -d' ' -f 2-)
echo "LOCAL or REMOTE ...........: $LOCALorREMOTE"
echo "TEAMVIEWER started ........: $TEAMVIEWER"
echo "SSH daemon started ........: $SSH"
echo "SLOW_USB_KEY_MODE .........: $SLOW_USB_KEY_MODE"
echo "SRR .......................: $SRR"
echo
echo "Watchdog ..................: $MINER_WATCHDOG"
echo "SYSRQ Reboot ..............: $SYSRQ_REBOOT"
echo "Watchdog Cycle ............: $WATCHDOG_CYCLE"
echo "GPU Utilization Threshold .: $GPU_UTIL_THRESHOLD"
echo "Alternate Pool ............: $ALT_POOL"
echo
# Temp control
echo "Temp Control ..............: $MINER_TEMP_CONTROL"
echo "MANUAL_FAN ................: $MANUAL_FAN"
if [[ $MANUAL_FAN == YES ]]
then
echo "MANUAL FAN_SPEED ..........: $FAN_SPEED"
fi
if [[ $MINER_TEMP_CONTROL == YES ]]
then
echo "TARGET_TEMP ...............: $TARGET_TEMP"
echo "__FAN_ADJUST ..............: $__FAN_ADJUST"
echo "POWER_ADJUST ..............: $POWER_ADJUST"
echo "ALLOWED_TEMP_DIFF .........: $ALLOWED_TEMP_DIFF"
echo "RESTORE_POWER_LIMIT .......: $RESTORE_POWER_LIMIT"
echo "MINIMAL_FAN_SPEED .........: $MINIMAL_FAN_SPEED"
echo "MAXIMAL_FAN_SPEED .........: $MAXIMAL_FAN_SPEED"
fi
echo
# 1bash maintenance
echo "CLEAR_LOGS_ON_BOOT ........: $CLEAR_LOGS_ON_BOOT"
echo "AUTO_REBOOT ...............: $AUTO_REBOOT"
if [[ $AUTO_REBOOT == YES ]]
then
echo "REBOOT_TIMEOUT_IN_MINUTES .: $REBOOT_TIMEOUT_IN_MINUTES"
fi
echo "_Parallax_MODE (upPaste)...: $_Parallax_MODE"
if [[ $_Parallax_MODE == YES ]]
then
echo "pasteBASH .................: $pasteBASH"
echo "upPASTE_TIMEOUT_IN_MINUTES.: $upPASTE_TIMEOUT_IN_MINUTES"
fi
echo
# 1bash telegram
echo "TELEGRAM_MESSAGES .: $TELEGRAM_MESSAGES"
echo "TELEGRAM_ALERTS ...: $TELEGRAM_ALERTS"
if [[ $TELEGRAM_MESSAGES == YES || $TELEGRAM_ALERTS == YES ]]
then
echo "TELEGRAM_TYPE .............: $TELEGRAM_TYPE"
echo "TELEGRAM_TIMEOUT_IN_MINUTES: $TELEGRAM_TIMEOUT_IN_MINUTES"
echo "TELEGRAM_CHATID ...........: CHATID_NOT_SHOWN"
echo "TELEGRAM_APIKEY ...........: APIKEY_NOT_SHOWN"
fi
echo
echo "HEADLESS MODE:.............: $HEADLESS_MODE"
echo "GPUPowerMizerMode_Adjust...: $GPUPowerMizerMode_Adjust"
if [[ $GPUPowerMizerMode_Adjust == YES ]]
then
echo "GPUPowerMizerMode .........: $GPUPowerMizerMode"
fi
echo "ETH Pill ..................: $OhGodAnETHlargementPill"
echo
GPUS=$(nvidia-smi -i 0 --query-gpu=count --format=csv,noheader,nounits)
# 1bash OC
echo "POWERLIMIT MODE ...........: $POWERLIMIT_MODE"
if [[ $POWERLIMIT_MODE == GLOBAL ]]
then
echo "Power Limit WATTS .........: $_POWERLIMIT_WATTS"
elif [[ $POWERLIMIT_MODE == ALGO_SPECIFIC ]]
then
eval 'ALGO_PL=${ALGO}_POWERLIMIT_WATTS'
echo "Power Limit WATTS .........: ${!ALGO_PL}"
elif [[ $POWERLIMIT_MODE == GPU_SPECIFIC ]]
then
for i in $(seq 0 $((GPUS-1)))
do
echo "GPU$i Power Limit ..........: $((INDIVIDUAL_POWERLIMIT_$i))"
done
elif [[ $POWERLIMIT_MODE == GLOBAL_with_GPU_OFFSET ]]
then
for i in $(seq 0 $((GPUS-1)))
do
echo "GPU$i Power Limit ..........: $(( _POWERLIMIT_WATTS + INDIVIDUAL_POWERLIMIT_$i ))"
done
elif [[ $POWERLIMIT_MODE == ALGO_SPECIFIC_with_GPU_OFFSET ]]
then
for i in $(seq 0 $((GPUS-1)))
do
echo "GPU$i Power Limit ..........: $(( ${ALGO}_POWERLIMIT_WATTS + INDIVIDUAL_POWERLIMIT_$i ))"
done
fi
echo "OVERCLOCK MODE ............: $OVERCLOCK_MODE"
if [[ $OVERCLOCK_MODE == GLOBAL ]]
then
echo "Memory Overclock ..........: $_MEMORY_OVERCLOCK"
echo "Core Overclock ............: $_CORE_OVERCLOCK"
elif [[ $OVERCLOCK_MODE == ALGO_SPECIFIC ]]
then
eval 'ALGO_OC=${ALGO}_CORE_OVERCLOCK'
eval 'ALGO_MC=${ALGO}_MEMORY_OVERCLOCK'
echo "Core Overclock ............: ${!ALGO_OC}"
echo "Memory Overclock ..........: ${!ALGO_MC}"
elif [[ $OVERCLOCK_MODE == GPU_SPECIFIC ]]
then
for i in $(seq 0 $((GPUS-1)))
do
echo "GPU$i Core Overclock ........: $((__CORE_OVERCLOCK_$i))"
echo "GPU$i Memory Overclock ......: $((MEMORY_OVERCLOCK_$i))"
done
elif [[ $OVERCLOCK_MODE == GLOBAL_with_GPU_OFFSET ]]
then
for i in $(seq 0 $((GPUS-1)))
do
echo "GPU$i Core Overclock ........: $(( _CORE_OVERCLOCK + __CORE_OVERCLOCK_$i )) "
echo "GPU$i Memory Overclock ......: $(( _MEMORY_OVERCLOCK + MEMORY_OVERCLOCK_$i ))"
done
elif [[ $OVERCLOCK_MODE == ALGO_SPECIFIC_with_GPU_OFFSET ]]
then
for i in $(seq 0 $((GPUS-1)))
do
echo "GPU$i Core Overclock ........: $(( ${ALGO}_CORE_OVERCLOCK + __CORE_OVERCLOCK_$i ))"
echo "GPU$i Memory Overclock ......: $(( ${ALGO}_MEMORY_OVERCLOCK + MEMORY_OVERCLOCK_$i ))"
done
fi
echo
# 1bash mining
echo "GLOBAL WORKERNAME .........: $GLOBAL_WORKERNAME"
echo "AUTO WORKERNAME ...........: $AUTO_WORKERNAME"
if [[ $AUTO_WORKERNAME == CUSTOM || $AUTO_WORKERNAME == HOST ]]
then
echo "WORKERNAME ................: $WORKERNAME"
elif [[ $AUTO_WORKERNAME == MAC ]]
then
WORKERNAME=$(echo $MAC_AS_WORKER | cut -d'_' -f 5-)
echo "WORKERNAME ................: hidden_$WORKERNAME"
fi
echo "plusCPU ...................: $plusCPU"
if [[ $plusCPU == YES ]]
then
echo "threadCOUNT ...............: $threadCOUNT"
fi
echo
# 1bash auto switching
echo "AUTO_SWITCH ...............: $AUTO_SWITCH"
if [[ $AUTO_SWITCH == WTM_SWITCHING ]]
then
echo "WTM_AUTO_SWITCH_COINS .....: $WTM_AUTO_SWITCH_COINS"
echo "WTM_AUTO_SWITCH_URL .......: ${WTM_AUTO_SWITCH_URL:0:49}"
fi
# 1bash coin, miner, pool, port, address
echo "COIN ......................: $COIN"
echo "ALGO ......................: $ALGO"
MINER=${ALGO}_MINER
echo "MINER .....................: ${!MINER}"
if [[ ${COIN:0:5} == ZPOOL ]]
then
echo "ZPOOLPASS .................: hidden_pass...,"$(echo $ZPOOLPASS | cut -d',' -f 2-)
fi
COIN_WORKER_TMP=${COIN}_WORKER
echo $COIN "WORKER ................:" ${!COIN_WORKER_TMP}
COIN_ADDRESS_TMP=${COIN}_ADDRESS
echo $COIN "ADDRESS ...............:" ${!COIN_ADDRESS_TMP::8}...
COIN_POOL_TMP=${COIN}_POOL
echo $COIN "POOL ..................:" ${!COIN_POOL_TMP}
COIN_PORT_TMP=${COIN}_PORT
if [[ ${!COIN_PORT_TMP} != "" ]]
then
echo $COIN "PORT ..................:" ${!COIN_PORT_TMP}
fi
ALGO_INTENSITY_TMP=${ALGO}_INTENSITY
if [[ ${!ALGO_INTENSITY_TMP} != "" ]]
then
echo $ALGO "INTENSITY ..........:" ${!ALGO_INTENSITY_TMP}
fi
echo
echo "[/code]"
echo
echo
echo "WORK IN PROGRESS! Report script (beta release)"
echo
echo "*** If posting the Report on bitcointalk.org forum please copy everything"
echo " between the [code] and [/code] including the [code] and [/code] tags."
echo " This will ensure proper alignment when posting the Report."
echo
echo
}
################################# Pull nvOC commits ##############################
Upgrade()
{
echo -e "${Y}Warnings${N}:
- your customized 1bash settings won't be affected, but you may have
to create a new one starting from a frash copy of ${B}1bash.template${N}
if it gets updated during this upgrade, otherwise you will get a
warning each time nvOC restarts
- the upgrade will fail safely if you made conflicting customizations
to any other nvOC script: if it happens you need either to run this
script with ${C}restore${N} command or manually manage this by git commands.
"
read -p "Do you want to continue (y/N)? " -n 1 ans
echo
if [[ ${ans,,} != y ]]
then
exit 0
fi
echo "Checking for nvOC updates... (target: '${NVOC}')"
git -C ${NVOC} pull
echo -e "nvOC has been upgraded."
# check 1bash revision mismatch
source "${NVOC}/1bash"
current_1bash_ver="$nvOC_1bash_ver"
source "${NVOC}/1bash.template"
template_1bash_ver="$nvOC_1bash_ver"
last_compatible_1bash_ver="$nvOC_1bash_last_compatible"
least_compatible_1bash_ver="$nvOC_1bash_least_compatible"
if (( 10#$current_1bash_ver < 10#$least_compatible_1bash_ver ))
then
echo -e " $(tput bold)################################################################################"
echo ""
echo -e "\e[31m Your 1bash revision is not compatible with latest update"
echo " Please update your 1bash from 1bash.template before restarting nvOC"
echo -e " $(tput sgr0)"
echo -e " $(tput bold)################################################################################ $(tput sgr0)"
elif (( 10#$current_1bash_ver < 10#$last_compatible_1bash_ver ))
then
echo -e " $(tput bold)################################################################################"
echo " Your 1bash revision is older than last compatible version"
echo " There are new features available if you update your 1bash with latest 1bash.template."
echo " Please, update your 1bash to comply with 1bash.template."
echo "################################################################################ $(tput sgr0)"
fi
echo -e "There may be new required miners packages to be installed.
Would you like to check for further miners updates and install them now?"
read -p "Do you want to continue (Y/n)? " -n 1 ans
echo
if [[ ${ans,,} != n ]]
then
MinersUpgrade
fi
}
################################# Restore working tree ##############################
Restore()
{
echo "Checking for modified contents..."
git -C ${NVOC} status -s -uno --ignore-submodules=all
echo "Stashing nvOC tree modifications"
git -C ${NVOC} stash
echo -e "${B}Done.${N} Your modified contents has been restored. You can now ${C}upgrade${N}."
echo "If you just made a mistake you can still recover your mods, see '${B}git stash --help${N}'."
}
################################# Pull and install miners submodule ##############################
MinersUpgrade()
{
echo "Checking for nvOC miners updates..."
chckt_cmd="git -C ${NVOC} submodule update --init --force --depth 1 --remote miners"
if ! ${chckt_cmd}
then
echo "Checkout from current branch failed, fetching other branches..."
git -C "${NVOC}/miners" remote set-branches origin '*'
git -C "${NVOC}/miners" fetch
if ! ${chckt_cmd}
then
echo "Unable to checkout latest miners submodule, can't find target commit."
return
fi
fi
echo "Running updates installer"
pushd .
bash ${NVOC}/miners/nvOC_miner_update.sh
popd
}
################################# install systemd nvoc.service template ##############################
InstallService()
{
echo -e "${Y}Warnings${N}:
- if you don't know what means to run nvOC as a system service you probably
don't need to run this command, please choose not to continue (press 'n')
- by default nvOC runs in gnome-terminal, installing it as a service will switch
to systemd instead
- the nvoc systemd service manifest has been tested successfully in some
environments, but it has to be still considered as beta
"
read -p "Do you want to continue (y/N)? " -n 1 ans
echo
if [[ ${ans,,} != y ]]
then
exit 0
fi
echo "Reinstalling nvOC service for ${NVOC}"
sudo bash -c 'cat > /etc/systemd/system/nvoc.service' << EOF
[Unit]
Description=nvOC Service
[Service]
Type=forking
User=$(whoami)
Environment=GPU_FORCE_64BIT_PTR=0
Environment=GPU_MAX_HEAP_SIZE=100
Environment=GPU_USE_SYNC_OBJECTS=1
Environment=GPU_MAX_ALLOC_PERCENT=100
Environment=GPU_SINGLE_ALLOC_PERCENT=100
Environment=DISPLAY=:0
Environment=XAUTHORITY=${HOME}/.Xauthority
Environment=NVOC=${NVOC}
WorkingDirectory=${NVOC}
ExecStart=/usr/bin/screen -c ${NVOC}/screenrc-main -dmSL main /bin/bash "${NVOC}/2unix"
Restart=always
[Install]
WantedBy=graphical.target
EOF