-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgpuhist.pl
executable file
·54 lines (41 loc) · 1.06 KB
/
gpuhist.pl
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
#!/bin/perl
$mins=120;
open (FH,"/var/hashcrack/temps.txt");
$temps=<FH>;
chomp($temps);
@atemps=split(m/,/,$temps);
close FH;
open (FH,"/var/hashcrack/fan.txt");
$fan=<FH>;
chomp($fan);
@afan=split(m/,/,$fan);
close FH;
$temp=`nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader,nounits | awk 'BEGIN {max = 0} {if (\$1>max) max=\$1} END {print max}'`;
$fan=`nvidia-smi --query-gpu=fan.speed --format=csv,noheader,nounits | awk 'BEGIN {max = 0} {if (\$1>max) max=\$1} END {print max}'`;
chomp($temp);
chomp($fan);
open(FH, '>', '/var/hashcrack/temps.txt');
$l=scalar @atemps;
$i=0; $acc="";
if ($l>$mins) { $i=$l-$mins; }
while ( $i < $l ) {
$acc .= $atemps[$i].",";
$i++;
}
$acc.=$temp;
print FH $acc;
close FH;
open(FH, '>', '/var/hashcrack/fan.txt');
$l=scalar @afan;
$i=0; $acc2="";
if ($l>$mins) { $i=$l-$mins; }
while ( $i < $l ) {
$acc2 .= $afan[$i].",";
$i++;
}
$acc2.=$fan;
print FH $acc2;
close FH;
open(FH, '>', '/var/hashcrack/temps-py.txt');
print FH "dict( fan_speed = [ ".$acc2." ], temperature = [ ".$acc." ] )\n";
close FH;