Page 2 of 2

Re: Shell script & "nvidia-smi" - needs right command/flag!

Posted: June 28th, 2015, 9:20 pm
by ricksebak
In fact, a while loop could work better than a for loop, since a while loop will still work with any number of GPU cores:

cat /tmp/nvidaoutput | while read line
> do
> newstr=$(echo $line | awk '{print $7}')
> echo $newstr
> done
49
39
44
47

Re: Shell script & "nvidia-smi" - needs right command/flag!

Posted: June 28th, 2015, 9:50 pm
by danhansen@denmark
Hi Riksebak,

Sorry my friend. I'm a newbie....

Code: Select all

# cat /tmp/nvidaoutput
cat: /tmp/nvidaoutput: No such file or directory


I'm running a Headless Ubuntu Server with CUDA70 and the nvidia driver which comes along with the .deb package. This does several things to a system which changes a lot of factors. E.g. your last suggestion, it doesn't give any output ;(

Re: Shell script & "nvidia-smi" - needs right command/flag!

Posted: June 28th, 2015, 9:54 pm
by ricksebak
TLDR: Change line 36 of your script to newstr=$(echo $str | awk '{print $7}') and it should work.

Longer version: I don't have an nvidia card, so I have no way to run nvidia-smi -q -d temperature | grep GPU | perl -pe '/^GPU/ && s/\n//' | grep ^GPU "GPU 0000:0$i:00.0". So in my example, I simply copied the output of your nvidia-smi command into a temporary file, catted that file, and used it just as an example so that you can see how I am setting str and newstr. So in my example, cat /tmp/nvidiaoutput would be equivalent to your nvidia-smi command.

Re: Shell script & "nvidia-smi" - needs right command/flag!

Posted: July 3rd, 2015, 7:45 pm
by danhansen@denmark
Hi Ricksebak,

"...So in my example, cat /tmp/nvidiaoutput would be equivalent to your nvidia-smi command..."

Sorry, I'm a rookie !! I should have known that, I can see that now. But, I got it to work, and when I've finished the whole ToDo I'll put it inhere for others to learn from! The basic script came from inhere some years back ;)

Thanks a lot my friend, for all the feedbacks.. Thanks!!
Have a nice weekend ;)

Kind Regards
Dan

Shell script "nvidia smi" needs right command/flag

Posted: September 15th, 2017, 1:59 pm
by Aaronsword
hello every one,


I cannot actually understand what is the difference between the mailbox and normal command mode.
both of them look similar in their functionality. I think there is some priority difference, i.e. may be mailbox has more priority than normal cmd mode, but I am not sure. Of course they are somewhat difference but what best utilize them?


Can any one explain this with a little example?


Thanks
jaffry