Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- # This file is part of BAMT.
- #
- # BAMT is free software: you can redistribute it and/or modify
- # it under the terms of the GNU General Public License as published by
- # the Free Software Foundation, either version 3 of the License, or
- # (at your option) any later version.
- #
- # BAMT is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License
- # along with BAMT. If not, see <http://www.gnu.org/licenses/>.
- require '/opt/bamt/common.pl';
- $SIG{__DIE__} = sub { die(@_); };
- use POSIX;
- if (@ARGV < 2)
- {
- die "usage: getgpudata # param";
- }
- if ($ARGV[0] eq 'all')
- {
- my $param = $ARGV[1];
- my (@gpus) = &getCachedGPUData(1);
- for (my $k = 0;$k < @gpus;$k++)
- {
- if (defined($gpus[$k]{$param}))
- {
- print $param . $k . ".value " . $gpus[$k]{$param} . "\n";
- }
- else
- {
- print $param . $k . ".value 0\n";
- }
- }
- exit(0);
- }
- else
- {
- die "non numeric gpu #?" unless (isdigit $ARGV[0]);
- my $gpu = $ARGV[0];
- my $param = $ARGV[1];
- my (@gpus) = &getCachedGPUData(1);
- if ($gpu >= @gpus)
- {
- print "no gpu $gpu\n";
- exit(1);
- }
- if (defined($gpus[$gpu]{$param}))
- {
- print $gpus[$gpu]{$param};
- exit(0);
- }
- else
- {
- print "no parameter $param\n";
- exit(1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment