Guest User

Untitled

a guest
Mar 15th, 2014
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3.  
  4. # This file is part of BAMT.
  5. #
  6. # BAMT is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation, either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # BAMT is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with BAMT. If not, see <http://www.gnu.org/licenses/>.
  18.  
  19.  
  20. require '/opt/bamt/common.pl';
  21. $SIG{__DIE__} = sub { die(@_); };
  22. use POSIX;
  23.  
  24. if (@ARGV < 2)
  25. {
  26. die "usage: getgpudata # param";
  27. }
  28.  
  29. if ($ARGV[0] eq 'all')
  30. {
  31. my $param = $ARGV[1];
  32. my (@gpus) = &getCachedGPUData(1);
  33.  
  34. for (my $k = 0;$k < @gpus;$k++)
  35. {
  36. if (defined($gpus[$k]{$param}))
  37. {
  38. print $param . $k . ".value " . $gpus[$k]{$param} . "\n";
  39. }
  40. else
  41. {
  42. print $param . $k . ".value 0\n";
  43. }
  44. }
  45. exit(0);
  46. }
  47. else
  48. {
  49. die "non numeric gpu #?" unless (isdigit $ARGV[0]);
  50.  
  51.  
  52. my $gpu = $ARGV[0];
  53. my $param = $ARGV[1];
  54.  
  55. my (@gpus) = &getCachedGPUData(1);
  56.  
  57. if ($gpu >= @gpus)
  58. {
  59. print "no gpu $gpu\n";
  60. exit(1);
  61. }
  62.  
  63. if (defined($gpus[$gpu]{$param}))
  64. {
  65. print $gpus[$gpu]{$param};
  66. exit(0);
  67. }
  68. else
  69. {
  70. print "no parameter $param\n";
  71. exit(1);
  72. }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment