Overclock.net › Forums › Software, Programming and Coding › Operating Systems › Linux, Unix › nvidia info in conky HELP
New Posts  All Forums:Forum Nav:

nvidia info in conky HELP - Page 3

post #21 of 31
Thread Starter 
Quote:
Originally Posted by lloyd mcclendon View Post

ok well, no difference really, if you are using the GPUs to fold (I thought the linux FOH client was still CPU ONLY) but if you are, measure your performance w/o measuring the temp, and measure it again with it running the temp check in the while loop and compare.

I'll be sure to do some comparison testing. The new cores for the GPU are native linux.

Once i get it working properly, I will. I'm sure it will come in handy. I may Put up a how to guide for a "folding friendly conky" once I get the data I need and the kinks worked out. I know a lot of the guys i the folding community may switch over to Linux completely if they like it. Plus the added steam for Linux. It seems that the support for more gaming and other uses are becoming more and more desired for Linux.
Edited by Asustweaker - 6/21/13 at 11:44am
Wet Willy
(17 items)
 
Oold man 555
(11 items)
 
 
CPUMotherboardGraphicsRAM
i7 920 @4.217 1.24 v's 24/7 Asus p6t6 ws Revolution (full water blocks) GTX 480 SLI @867-1734 samsung 30nm at 2040mhz. 8-9-9-26 1.54v's 
Hard DriveOptical DriveCoolingCooling
OCZ Agility 3 RAID0 lite on dvd burner Raystorm Danger Den 480 Full copper (paralleled)  
OSMonitorMonitorKeyboard
Dual boot, Windows7 64bit/Linux ubuntu64bit 1hpw2207h1680/1050  Sharp 60" LED 120hz s510 
PowerCaseMouseAudio
Ultra 1600w X4 NZXT, Tempest EVO logitech s510 combo Harmon Kardon AVR245 
CPUMotherboardGraphicsRAM
Phenom II X4 B55 m4n82 deluxe ghetto gtx 460 patriot viper 1066 
Hard DriveOptical DriveCoolingOS
some crap sata dvd thermal take big typhoon windows 7 ultimate  
MonitorPowerCase
hp 2207h ultra lsp 750watt cooler master elite 
  hide details  
Reply
Wet Willy
(17 items)
 
Oold man 555
(11 items)
 
 
CPUMotherboardGraphicsRAM
i7 920 @4.217 1.24 v's 24/7 Asus p6t6 ws Revolution (full water blocks) GTX 480 SLI @867-1734 samsung 30nm at 2040mhz. 8-9-9-26 1.54v's 
Hard DriveOptical DriveCoolingCooling
OCZ Agility 3 RAID0 lite on dvd burner Raystorm Danger Den 480 Full copper (paralleled)  
OSMonitorMonitorKeyboard
Dual boot, Windows7 64bit/Linux ubuntu64bit 1hpw2207h1680/1050  Sharp 60" LED 120hz s510 
PowerCaseMouseAudio
Ultra 1600w X4 NZXT, Tempest EVO logitech s510 combo Harmon Kardon AVR245 
CPUMotherboardGraphicsRAM
Phenom II X4 B55 m4n82 deluxe ghetto gtx 460 patriot viper 1066 
Hard DriveOptical DriveCoolingOS
some crap sata dvd thermal take big typhoon windows 7 ultimate  
MonitorPowerCase
hp 2207h ultra lsp 750watt cooler master elite 
  hide details  
Reply
post #22 of 31
If you do end up putting together a 'folding friendly conky', I have a couple more scripts I use personally for VRAM, HDD temps, and GPU fan speed. Let me know if you would like them.

Edit:

On second thought, I'm going to combine them into one script which takes arguments. They all call nvidia-smi (with the exception of the HDD one), so I can just separate the different bits of information into functions. I should have this finished tonight. biggrin.gif
Edited by Ferrari8608 - 6/21/13 at 2:04pm
post #23 of 31
Thread Starter 
SMI doesn't support anything but temp for all cards other than tesla, and quadro cards. As for fan speeds, I still haven't had to mess with that at all. all waterblocked up here.

Either way all of it will be usefull, just have to tailor certain things to card generations. Once all this is pretty user friendly to apply. It will go in the folding sub-forum for approval for a guide or as a sticky.

I just remember I gotta wipe out the ssd my main rig is running linux from. gave it away in the foldathon this year. Gonna have to back up everything. Plus I can go to straight "KDE" I did the KDE add on to an Ubuntu distro, and have noticed quite a few conflicts.
Edited by Asustweaker - 6/21/13 at 2:19pm
Wet Willy
(17 items)
 
Oold man 555
(11 items)
 
 
CPUMotherboardGraphicsRAM
i7 920 @4.217 1.24 v's 24/7 Asus p6t6 ws Revolution (full water blocks) GTX 480 SLI @867-1734 samsung 30nm at 2040mhz. 8-9-9-26 1.54v's 
Hard DriveOptical DriveCoolingCooling
OCZ Agility 3 RAID0 lite on dvd burner Raystorm Danger Den 480 Full copper (paralleled)  
OSMonitorMonitorKeyboard
Dual boot, Windows7 64bit/Linux ubuntu64bit 1hpw2207h1680/1050  Sharp 60" LED 120hz s510 
PowerCaseMouseAudio
Ultra 1600w X4 NZXT, Tempest EVO logitech s510 combo Harmon Kardon AVR245 
CPUMotherboardGraphicsRAM
Phenom II X4 B55 m4n82 deluxe ghetto gtx 460 patriot viper 1066 
Hard DriveOptical DriveCoolingOS
some crap sata dvd thermal take big typhoon windows 7 ultimate  
MonitorPowerCase
hp 2207h ultra lsp 750watt cooler master elite 
  hide details  
Reply
Wet Willy
(17 items)
 
Oold man 555
(11 items)
 
 
CPUMotherboardGraphicsRAM
i7 920 @4.217 1.24 v's 24/7 Asus p6t6 ws Revolution (full water blocks) GTX 480 SLI @867-1734 samsung 30nm at 2040mhz. 8-9-9-26 1.54v's 
Hard DriveOptical DriveCoolingCooling
OCZ Agility 3 RAID0 lite on dvd burner Raystorm Danger Den 480 Full copper (paralleled)  
OSMonitorMonitorKeyboard
Dual boot, Windows7 64bit/Linux ubuntu64bit 1hpw2207h1680/1050  Sharp 60" LED 120hz s510 
PowerCaseMouseAudio
Ultra 1600w X4 NZXT, Tempest EVO logitech s510 combo Harmon Kardon AVR245 
CPUMotherboardGraphicsRAM
Phenom II X4 B55 m4n82 deluxe ghetto gtx 460 patriot viper 1066 
Hard DriveOptical DriveCoolingOS
some crap sata dvd thermal take big typhoon windows 7 ultimate  
MonitorPowerCase
hp 2207h ultra lsp 750watt cooler master elite 
  hide details  
Reply
post #24 of 31
SMI shows a few stats for my card. I can see temperature, fan speed percentage (which I converted to RPM with some maths), and VRAM usage. Now, the RPM part would be tricky as I don't know the max fan speed for most fans. You said that isn't an issue since you're under water, so I can work that out later.
post #25 of 31
Thread Starter 
Quote:
Originally Posted by Ferrari8608 View Post

Sorry, I did miss a line.
Code:
try:
    for line in output.split('\n'):
    yield line

Should be
Code:
try:
    for line in output.split('\n'):
        yield line

Add 4 spaces in front of yield.

I fixed it above. I also double-checked for any more indention issues, and there are none. This is a result of having to open the script in a GUI text editor to copy it to here, and then the indention got all screwey when I pasted it. I tried to fix it, but apparently I overlooked a few lines.

It worked!!! HAAAZAAAAAA!!!! Thank you so much man.

Now to do some testing to see if the split monitoring loop is going to affect the folding performance

Below script, with the proper indentation on line 11 fixed it. And is functional. Must follow the full process supplied by Ferrari
Warning: Spoiler! (Click to show)
Code:
#!/usr/bin/env python

import subprocess
import sys

def nvidia_smi():
    cmd = ['nvidia-smi','-q']
    output = subprocess.check_output(cmd).decode("utf-8")
    try:
        for line in output.split('\n'):
            yield line
    except subprocess.CalledProcessError:
        sys.stdout.write('ERROR: nvidia-smi failed with a nonzero exitcode')
        sys.exit(1)

def main():
    gpu = int(sys.argv[1])
    smi_output = [line for line in nvidia_smi() if 'Gpu' in line and 'C' in line]

    temps = []
    for item in smi_output:
        temps.append(item.split()[2])

    try:
        sys.stdout.write(temps[gpu])
    except IndexError:
        sys.stdout.write('Invalid GPU number specified')
        sys.exit(1)

if __name__ == '__main__':
    main()

Full conky script
Warning: Spoiler! (Click to show)
Code:
use_xft yes
xftfont Terminus:size=8
xftalpha 0.8
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
own_window_argb_visual yes
own_window_type normal
own_window_class conky-semi
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
background no
double_buffer yes
minimum_size 300 200
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
default_shade_color black
default_outline_color white
default_bar_size 150 5
default_gauge_size 20 20
imlib_cache_size 0
draw_shades no
alignment top_right
gap_x 5
gap_y 5
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale no
default_color ECEAE4
color1 light blue
color2 01C423
TEXT
$color
${color CC9900}SYSTEM ${hr 2}$color
${color 597DB2}Linux Worker Bee

${color CC9900}MOTHERBOARD ${hr 2}$color
${color 597DB2}Asus p6t6ws Revolution$color          Board Temp:${color FFFF33} ${exec sensors | awk '/MB Temperature/ {print substr($3,2,4)}'} C$color    
 
${color CC9900}CPU ${hr 2}$color
${color 597DB2}Intel Core i7 920$color @ 4017 MHZ   Socket Temp:${color FFFF33} ${exec sensors | awk '/CPU Temperature/ {print substr($3,2,4)}'} C$color

Total CPU usage: ${cpu cpu0}%
${cpugraph 000000 597DB2}
Core 1 usage                   
${cpu cpu1}% ${color 597DB2}${cpubar cpu1}$color ${alignr}Core 1 Temp:${color FFFF33} ${exec sensors | awk '/Core 0/ {print substr($3,2,4)}'} C$color     
${cpu cpu2}% ${color 597DB2}${cpubar cpu2}$color
Core 2 usage                   
${cpu cpu3}% ${color 597DB2}${cpubar cpu3}$color ${alignr}Core 2 Temp:${color FFFF33} ${exec sensors | awk '/Core 1/ {print substr($3,2,4)}'} C$color   
${cpu cpu4}% ${color 597DB2}${cpubar cpu4}$color
Core 3 usage                   
${cpu cpu5}% ${color 597DB2}${cpubar cpu5}$color ${alignr}Core 3 Temp:${color FFFF33} ${exec sensors | awk '/Core 2/ {print substr($3,2,4)}'} C$color   
${cpu cpu6}% ${color 597DB2}${cpubar cpu6}$color
Core 4 usage                   
${cpu cpu7}% ${color 597DB2}${cpubar cpu7}$color ${alignr}Core 4 Temp:${color FFFF33} ${exec sensors | awk '/Core 3/ {print substr($3,2,4)}'} C$color   
${cpu cpu8}% ${color 597DB2}${cpubar cpu8}$color
GTX 480-1 Temp:${color FFFF33}${alignr}${execpi 10 ~/.conky_scripts/gpu_temp.py 0} C$color
GTX 480-2 Temp:${color FFFF33}${alignr}${execpi 10 ~/.conky_scripts/gpu_temp.py 1} C$color

${color CC9900}NETWORK I.P. (${addr eth1}) ${hr 2}$color
Down: $color${downspeed eth1} k/s ${alignr}Up: ${upspeed eth1} k/s
${downspeedgraph eth1 25,140 000000 ff0000} ${alignr}${upspeedgraph eth1
25,140 000000 00ff00}$color
Total: ${totaldown eth1} ${alignr}Total: ${totalup eth1}
Inbound: ${tcp_portmon 1 32767 count} Outbound: ${tcp_portmon 32768
61000 count}${alignr}Total: ${tcp_portmon 1 65535 count}

${font sans-serif:bold:size=8}${color FF9900}FOLDING AT HOME ${hr 2}${font sans-serif:normal:size=8}
${color white}SMP Progress:${alignr}${execi 15 cat /var/lib/fahclient/log.txt | tr '(' '\n' |tr ')' '\n' | grep -E "(%|percent)"|tail -n 1 | tr -d 'percent' | tr -d '%'} %${execibar 15 cat /var/lib/fahclient/log.txt | tr '(' '\n' |tr ')' '\n' | grep -E "(%|percent)"|tail -n 1 | tr -d 'percent' | tr -d '%'}
${color white}GPU 1 Progress: ${alignr}${execi 15 cat /var/lib/fahclient/work/02/logfile_01.txt | tr '(' '\n' |tr ')' '\n' | grep -E "(%|percent)"|tail -n 1 | tr -d 'percent' | tr -d '%'} %${execibar 15 cat /var/lib/fahclient/work/02/logfile_00.txt | tr '(' '\n' |tr ')' '\n' | grep -E "(%|percent)"|tail -n 1 | tr -d 'percent' | tr -d '%'}
${color white}GPU 2 Progress: ${alignr}${execi 15 cat /var/lib/fahclient/work/03/logfile_01.txt | tr '(' '\n' |tr ')' '\n' | grep -E "(%|percent)"|tail -n 1 | tr -d 'percent' | tr -d '%'} %${execibar 15 cat /var/lib/fahclient/work/03/logfile_01.txt | tr '(' '\n' |tr ')' '\n' | grep -E "(%|percent)"|tail -n 1 | tr -d 'percent' | tr -d '%'}

One anoying problem at hand that I have not figured out how to address is that when the GPU's finish a work unit the client opens a new folder in the "work directory" and labels it with a different number. Thus forcing you to check it, amend the 2 sections with this line " ${execi 15 cat /var/lib/fahclient/work/02/logfile_01.txt " You have to change the work folder number.I know It is from the client downloading the next work unit prior to current one's completion, resulting in an additional folder with a new label. I believe it would take a pretty ingenious method, or "script" for the "execi 15 (work directory)" line to automatically detect and update with correct data.

But I can live with it for now.

Here's the current finished product


Thanks everyone for their help. I am going to post this in the folding section to see if there is considerable interest in refining it, and tailoring it to specific systems.
Edited by Asustweaker - 6/22/13 at 12:00am
Wet Willy
(17 items)
 
Oold man 555
(11 items)
 
 
CPUMotherboardGraphicsRAM
i7 920 @4.217 1.24 v's 24/7 Asus p6t6 ws Revolution (full water blocks) GTX 480 SLI @867-1734 samsung 30nm at 2040mhz. 8-9-9-26 1.54v's 
Hard DriveOptical DriveCoolingCooling
OCZ Agility 3 RAID0 lite on dvd burner Raystorm Danger Den 480 Full copper (paralleled)  
OSMonitorMonitorKeyboard
Dual boot, Windows7 64bit/Linux ubuntu64bit 1hpw2207h1680/1050  Sharp 60" LED 120hz s510 
PowerCaseMouseAudio
Ultra 1600w X4 NZXT, Tempest EVO logitech s510 combo Harmon Kardon AVR245 
CPUMotherboardGraphicsRAM
Phenom II X4 B55 m4n82 deluxe ghetto gtx 460 patriot viper 1066 
Hard DriveOptical DriveCoolingOS
some crap sata dvd thermal take big typhoon windows 7 ultimate  
MonitorPowerCase
hp 2207h ultra lsp 750watt cooler master elite 
  hide details  
Reply
Wet Willy
(17 items)
 
Oold man 555
(11 items)
 
 
CPUMotherboardGraphicsRAM
i7 920 @4.217 1.24 v's 24/7 Asus p6t6 ws Revolution (full water blocks) GTX 480 SLI @867-1734 samsung 30nm at 2040mhz. 8-9-9-26 1.54v's 
Hard DriveOptical DriveCoolingCooling
OCZ Agility 3 RAID0 lite on dvd burner Raystorm Danger Den 480 Full copper (paralleled)  
OSMonitorMonitorKeyboard
Dual boot, Windows7 64bit/Linux ubuntu64bit 1hpw2207h1680/1050  Sharp 60" LED 120hz s510 
PowerCaseMouseAudio
Ultra 1600w X4 NZXT, Tempest EVO logitech s510 combo Harmon Kardon AVR245 
CPUMotherboardGraphicsRAM
Phenom II X4 B55 m4n82 deluxe ghetto gtx 460 patriot viper 1066 
Hard DriveOptical DriveCoolingOS
some crap sata dvd thermal take big typhoon windows 7 ultimate  
MonitorPowerCase
hp 2207h ultra lsp 750watt cooler master elite 
  hide details  
Reply
post #26 of 31
I worked on the script some more last night, got most of it done. All of the functions for parsing the SMI output are finished, and I got most of the argument parser finished too. All I'm missing is the main() function for calling the other functions based on the arguments. I doubt I'll get that finished tonight as I'm working a 12 hour shift today, but tomorrow is definitely possible.

That's a pretty sweet Conky setup thumb.gif

If you would like me to take a stab at a script for the WU monitor, PM me with the details and any log output or file names required. I love scripting projects, especially if I can contribute back to the community with them biggrin.gif
post #27 of 31
Thread Starter 
cool man. I'll shot a pm with some of the bugs, and what is a viable solution. I posted the "how to guide" in the folding sub-forum, but have not gotten any replies. People are looking at it, but not sure if it will catch right away. Switching over to Linux is usually a big change for a lot of people. Let alone detailed scripts, and semi-advanced configurations.

The complete how to for what we have finished so far can be found here: http://www.overclock.net/t/1403048/conky-folding-specific-useful-accessory-for-the-new-native-gpu-folding-in-linux
Wet Willy
(17 items)
 
Oold man 555
(11 items)
 
 
CPUMotherboardGraphicsRAM
i7 920 @4.217 1.24 v's 24/7 Asus p6t6 ws Revolution (full water blocks) GTX 480 SLI @867-1734 samsung 30nm at 2040mhz. 8-9-9-26 1.54v's 
Hard DriveOptical DriveCoolingCooling
OCZ Agility 3 RAID0 lite on dvd burner Raystorm Danger Den 480 Full copper (paralleled)  
OSMonitorMonitorKeyboard
Dual boot, Windows7 64bit/Linux ubuntu64bit 1hpw2207h1680/1050  Sharp 60" LED 120hz s510 
PowerCaseMouseAudio
Ultra 1600w X4 NZXT, Tempest EVO logitech s510 combo Harmon Kardon AVR245 
CPUMotherboardGraphicsRAM
Phenom II X4 B55 m4n82 deluxe ghetto gtx 460 patriot viper 1066 
Hard DriveOptical DriveCoolingOS
some crap sata dvd thermal take big typhoon windows 7 ultimate  
MonitorPowerCase
hp 2207h ultra lsp 750watt cooler master elite 
  hide details  
Reply
Wet Willy
(17 items)
 
Oold man 555
(11 items)
 
 
CPUMotherboardGraphicsRAM
i7 920 @4.217 1.24 v's 24/7 Asus p6t6 ws Revolution (full water blocks) GTX 480 SLI @867-1734 samsung 30nm at 2040mhz. 8-9-9-26 1.54v's 
Hard DriveOptical DriveCoolingCooling
OCZ Agility 3 RAID0 lite on dvd burner Raystorm Danger Den 480 Full copper (paralleled)  
OSMonitorMonitorKeyboard
Dual boot, Windows7 64bit/Linux ubuntu64bit 1hpw2207h1680/1050  Sharp 60" LED 120hz s510 
PowerCaseMouseAudio
Ultra 1600w X4 NZXT, Tempest EVO logitech s510 combo Harmon Kardon AVR245 
CPUMotherboardGraphicsRAM
Phenom II X4 B55 m4n82 deluxe ghetto gtx 460 patriot viper 1066 
Hard DriveOptical DriveCoolingOS
some crap sata dvd thermal take big typhoon windows 7 ultimate  
MonitorPowerCase
hp 2207h ultra lsp 750watt cooler master elite 
  hide details  
Reply
post #28 of 31
Thread Starter 
Performance impact comparison has been completed.

With the pyhton script calling on "Nvidia-SMI" for temperature monitoring of multiple cards. I have ZERO IMPACT on folding performance.

I will try some 3D apps aolne, and see if i suffer any loss in performance with this running.
Wet Willy
(17 items)
 
Oold man 555
(11 items)
 
 
CPUMotherboardGraphicsRAM
i7 920 @4.217 1.24 v's 24/7 Asus p6t6 ws Revolution (full water blocks) GTX 480 SLI @867-1734 samsung 30nm at 2040mhz. 8-9-9-26 1.54v's 
Hard DriveOptical DriveCoolingCooling
OCZ Agility 3 RAID0 lite on dvd burner Raystorm Danger Den 480 Full copper (paralleled)  
OSMonitorMonitorKeyboard
Dual boot, Windows7 64bit/Linux ubuntu64bit 1hpw2207h1680/1050  Sharp 60" LED 120hz s510 
PowerCaseMouseAudio
Ultra 1600w X4 NZXT, Tempest EVO logitech s510 combo Harmon Kardon AVR245 
CPUMotherboardGraphicsRAM
Phenom II X4 B55 m4n82 deluxe ghetto gtx 460 patriot viper 1066 
Hard DriveOptical DriveCoolingOS
some crap sata dvd thermal take big typhoon windows 7 ultimate  
MonitorPowerCase
hp 2207h ultra lsp 750watt cooler master elite 
  hide details  
Reply
Wet Willy
(17 items)
 
Oold man 555
(11 items)
 
 
CPUMotherboardGraphicsRAM
i7 920 @4.217 1.24 v's 24/7 Asus p6t6 ws Revolution (full water blocks) GTX 480 SLI @867-1734 samsung 30nm at 2040mhz. 8-9-9-26 1.54v's 
Hard DriveOptical DriveCoolingCooling
OCZ Agility 3 RAID0 lite on dvd burner Raystorm Danger Den 480 Full copper (paralleled)  
OSMonitorMonitorKeyboard
Dual boot, Windows7 64bit/Linux ubuntu64bit 1hpw2207h1680/1050  Sharp 60" LED 120hz s510 
PowerCaseMouseAudio
Ultra 1600w X4 NZXT, Tempest EVO logitech s510 combo Harmon Kardon AVR245 
CPUMotherboardGraphicsRAM
Phenom II X4 B55 m4n82 deluxe ghetto gtx 460 patriot viper 1066 
Hard DriveOptical DriveCoolingOS
some crap sata dvd thermal take big typhoon windows 7 ultimate  
MonitorPowerCase
hp 2207h ultra lsp 750watt cooler master elite 
  hide details  
Reply
post #29 of 31
The script, version 1.0, is finished! It parses nvidia-smi for all information relevant (to an average GeForce) GPU.

Usage:
Code:
$ ./gpu_stats.py -h
usage: gpu_stats.py [option] gpu

Parse the output of the nvidia-smi utility for simple Conky integration

positional arguments:
  gpu            GPU number, first GPU is 0

optional arguments:
  -h, --help     show this help message and exit
  -v, --verbose  display error messages
  --version      show program's version number and exit
  --fan-speed    fan speed as a percentage
  --temperature  GPU temperature in degrees Celsius
  --vram-free    free VRAM in megabytes
  --vram-used    used VRAM in megabytes
  --vram-total   total VRAM in megabytes

Example: python gpu_stats.py --temperature 0

gpu_stats.py
  • Extensive error checking for most situations where the script could fail
  • Compatible with both Python 2.7+ and 3
  • Light on memory and CPU usage
  • Easy to use command line options

You can check your version of Python with:
Code:
$ python --version

The script's help and usage (in the above 'code' block) can be viewed at any time from the command line by running:
Code:
$ ./gpu_stats.py -h
or
$ ./gpu_stats.py --help

Unless you specify the '-v' or '--verbose' option when running it, my script will output only a number or simply nothing at all. If nothing is displayed, you can run the script at the command line with '-v' or '--verbose' and view the error message.

So, here it is: The script (113 lines) (Click to show)
Code:
#!/usr/bin/env python

import argparse
import subprocess
import sys

def nvidia_smi(verbose):
    cmd = ['nvidia-smi','-q']
    try:
        output = subprocess.check_output(cmd).decode("utf-8")
    except subprocess.CalledProcessError:
        if verbose:
            sys.stdout.write('ERROR: nvidia-smi failed with a nonzero exitcode')
        sys.exit(1)

    for line in output.splitlines():
        yield line

def fan_percent(smi_output,gpu):
    percentages = []
    for line in smi_output:
        if 'Fan Speed' in line:
            percentages.append(line.split()[2])

    return percentages[gpu]

def temperature(smi_output,gpu):
    temps = []
    for line in smi_output:
        if 'Gpu' in line and 'C' in line:
            temps.append(line.split()[2])

    return temps[gpu]

def vram_free(smi_output,gpu):
    free = []
    for line in smi_output:
        if 'Free' in line and 'MB' in line:
            free.append(line.split()[2])

    return free[gpu]

def vram_used(smi_output,gpu):
    usage = []
    for line in smi_output:
        if 'Used' in line and 'MB' in line:
            usage.append(line.split()[2])

    return usage[gpu]

def vram_total(smi_output,gpu):
    totals = []
    for line in smi_output:
        if 'Total' in line and 'MB' in line:
            totals.append(line.split()[2])

    return totals[gpu]

def main(args):
    verbose = args.verbose
    gpu = args.gpu[0]
    
    try:
        smi_output = [line for line in nvidia_smi(verbose) if 'N/A' not in line]
    except (OSError,FileNotFoundError):
        if verbose:
            sys.stdout.write('ERROR: nvidia-smi binary not found in path')
        sys.exit(1)

    try:
        argarray = {
            'fanpct'    : fan_percent(smi_output,gpu),
            'temp'      : temperature(smi_output,gpu),
            'vramfree'  : vram_free(smi_output,gpu),
            'vramused'  : vram_used(smi_output,gpu),
            'vramtotal' : vram_total(smi_output,gpu)
        }
    except IndexError:
        if verbose:
            sys.stdout.write('ERROR: Invalid GPU specified')
        sys.exit(1)

    del smi_output

    for arg in vars(args):
        try:
            sys.stdout.write(argarray[arg])
            sys.exit()
        except KeyError:
            pass

if __name__ == '__main__':
    desc = 'Parse the output of the nvidia-smi utility for simple Conky integration'
    use = '%(prog)s [option] gpu'
    ep = 'Example: python %(prog)s --temperature 0'
    parser = argparse.ArgumentParser(usage=use,description=desc,epilog=ep)
    parser.add_argument('-v','--verbose',action='store_true',default=False,dest='verbose',
                        help='display error messages')
    parser.add_argument('--version',action='version',version='%(prog)s 1.1')
    group = parser.add_mutually_exclusive_group(required=True)
    group.add_argument('--fan-speed',action='store_true',default=argparse.SUPPRESS,dest='fanpct',
                        help='fan speed as a percentage')
    group.add_argument('--temperature',action='store_true',default=argparse.SUPPRESS,dest='temp',
                        help='GPU temperature in degrees Celsius')
    group.add_argument('--vram-free',action='store_true',default=argparse.SUPPRESS,dest='vramfree',
                        help='free VRAM in megabytes')
    group.add_argument('--vram-used',action='store_true',default=argparse.SUPPRESS,dest='vramused',
                        help='used VRAM in megabytes')
    group.add_argument('--vram-total',action='store_true',default=argparse.SUPPRESS,dest='vramtotal',
                        help='total VRAM in megabytes')
    parser.add_argument('gpu',action='store',type=int,nargs=1,
                        help='GPU number, first GPU is 0')
    args = parser.parse_args()
    main(args)

Plans for version 2.0:
  • VRAM usage percentages
  • Video card name display
  • Example Conky usage in help output
  • Code comments

If you find a bug, please let me know in a PM and I will fix it as soon as possible. I am also open to suggestions on features and such. Enjoy!
Edited by Ferrari8608 - 6/25/13 at 6:24am
post #30 of 31
Thread Starter 
I will definitely get into this a little more when I'm not on my lappy. This will make "Nvidia-SMI" work completely with most Geforce video cards? Cuz I was only able to view a very small amount of active data.
Wet Willy
(17 items)
 
Oold man 555
(11 items)
 
 
CPUMotherboardGraphicsRAM
i7 920 @4.217 1.24 v's 24/7 Asus p6t6 ws Revolution (full water blocks) GTX 480 SLI @867-1734 samsung 30nm at 2040mhz. 8-9-9-26 1.54v's 
Hard DriveOptical DriveCoolingCooling
OCZ Agility 3 RAID0 lite on dvd burner Raystorm Danger Den 480 Full copper (paralleled)  
OSMonitorMonitorKeyboard
Dual boot, Windows7 64bit/Linux ubuntu64bit 1hpw2207h1680/1050  Sharp 60" LED 120hz s510 
PowerCaseMouseAudio
Ultra 1600w X4 NZXT, Tempest EVO logitech s510 combo Harmon Kardon AVR245 
CPUMotherboardGraphicsRAM
Phenom II X4 B55 m4n82 deluxe ghetto gtx 460 patriot viper 1066 
Hard DriveOptical DriveCoolingOS
some crap sata dvd thermal take big typhoon windows 7 ultimate  
MonitorPowerCase
hp 2207h ultra lsp 750watt cooler master elite 
  hide details  
Reply
Wet Willy
(17 items)
 
Oold man 555
(11 items)
 
 
CPUMotherboardGraphicsRAM
i7 920 @4.217 1.24 v's 24/7 Asus p6t6 ws Revolution (full water blocks) GTX 480 SLI @867-1734 samsung 30nm at 2040mhz. 8-9-9-26 1.54v's 
Hard DriveOptical DriveCoolingCooling
OCZ Agility 3 RAID0 lite on dvd burner Raystorm Danger Den 480 Full copper (paralleled)  
OSMonitorMonitorKeyboard
Dual boot, Windows7 64bit/Linux ubuntu64bit 1hpw2207h1680/1050  Sharp 60" LED 120hz s510 
PowerCaseMouseAudio
Ultra 1600w X4 NZXT, Tempest EVO logitech s510 combo Harmon Kardon AVR245 
CPUMotherboardGraphicsRAM
Phenom II X4 B55 m4n82 deluxe ghetto gtx 460 patriot viper 1066 
Hard DriveOptical DriveCoolingOS
some crap sata dvd thermal take big typhoon windows 7 ultimate  
MonitorPowerCase
hp 2207h ultra lsp 750watt cooler master elite 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Linux, Unix
Overclock.net › Forums › Software, Programming and Coding › Operating Systems › Linux, Unix › nvidia info in conky HELP