NVidia GPU graph project need help please [SOLVED]

Add functionality to your desktop
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Post Reply
User avatar
Logansfury
Level 8
Level 8
Posts: 2346
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

NVidia GPU graph project need help please [SOLVED]

Post by Logansfury »

Hello everyone,

I have got GPU usage in a percentage successfully updating every 5 seconds. I can't seem to get the graph to display however.

Here is my code:

Code: Select all

conky.config = {
	
	update_interval = 5,
	cpu_avg_samples = 2,
	net_avg_samples = 2,
	out_to_console = false,
	override_utf8_locale = true,
	double_buffer = true,
	no_buffers = true,
	text_buffer_size = 32768,
	imlib_cache_size = 0,
	own_window = true,
	own_window_type = 'normal',
	own_window_argb_visual = true,
	own_window_argb_value = 50,
	own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
	border_inner_margin = 5,
	border_outer_margin = 0,
	gap_x = 0,
	gap_y = 0,
	draw_shades = false,
	draw_outline = false,
	draw_borders = false,
	draw_graph_borders = false,
	use_xft = true,
	font = 'Neon 80s:size=24',
	xftalpha = 0.8,
	uppercase = false,
	color = 'white',
	own_window_colour = '#000000',
	minimum_width = 300, minimum_height = 100,
	alignment = 'middle_middle',

};
conky.text = [[

${color}${font}GPU: ${execp nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits}%
${color}${execgraph "echo $(execp nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits)" 40,100 ffff00 ff0000 -t}
]]
top line works fine, 2nd line isn't displaying anything

Can anyone help me edit the command?

Thanks for reading,

Logan
Last edited by Logansfury on Mon May 20, 2024 12:20 pm, edited 1 time in total.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
zcot
Level 9
Level 9
Posts: 2956
Joined: Wed Oct 19, 2016 6:08 pm

Re: NVidia GPU graph project need help please

Post by zcot »

Code: Select all

man conky | grep "^       execgraph" -A18
also of possible interest is nvidiagraph.
User avatar
Logansfury
Level 8
Level 8
Posts: 2346
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: NVidia GPU graph project need help please

Post by Logansfury »

Good Morning Zcot,

I have gone over the manual and checked out the nvidia section. The first section was easy to understand, and I just made a test widget with all the listed commands, gputemp, gpufreq etc. That's working fine.

I cannot figure out the syntax for using nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits I used your echo statement from the AMD GPU graph but as soon as I try to run code with it, the widget gets broken.

How do I format the above code to work please?
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 8
Level 8
Posts: 2067
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: NVidia GPU graph project need help please

Post by Koentje »

Try and remove the height,width values!

Code: Select all

${execgraph "echo $(execp nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits)" ffff00 ff0000 -t}
Does this work?
Image
User avatar
Logansfury
Level 8
Level 8
Posts: 2346
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: NVidia GPU graph project need help please

Post by Logansfury »

Koentje wrote: Mon May 20, 2024 11:21 am Try and remove the height,width values!

Code: Select all

${execgraph "echo $(execp nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits)" ffff00 ff0000 -t}
Does this work?
That at the least stopped breaking the code. Everything else is displaying but the graph isn't present or operating.

As an experiment I also tried ${nvidiagraph "echo $(execp nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits)" ffff00 ff0000 -t}
but that only broke the code completely and prevented everything else from displaying.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 8
Level 8
Posts: 2067
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: NVidia GPU graph project need help please

Post by Koentje »

whahah.. i see a stupid mistake that i overlooked also!
You try to run a conky object in a shell...

Code: Select all

${execgraph "echo $(execp nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits)" 40,100 ffff00 ff0000 -t}
Remove the execp after echo!!
Image
User avatar
Logansfury
Level 8
Level 8
Posts: 2346
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: NVidia GPU graph project need help please

Post by Logansfury »

Koentje wrote: Mon May 20, 2024 11:35 am whahah.. i see a stupid mistake that i overlooked also!
You try to run a conky object in a shell...

Code: Select all

${execgraph "echo $(execp nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits)" 40,100 ffff00 ff0000 -t}
Remove the execp after echo!!
WAZOOOOOOOOOOO!!!! :D

I see a graph!!! For some reason its just the indicators, why isn't my rectangular outline showing?

Image

Code: Select all

conky.config = {
	
	update_interval = 5,
	cpu_avg_samples = 2,
	net_avg_samples = 2,
	out_to_console = false,
	override_utf8_locale = true,
	double_buffer = true,
	no_buffers = true,
	text_buffer_size = 32768,
	imlib_cache_size = 0,
	own_window = true,
	own_window_type = 'normal',
	own_window_argb_visual = true,
	own_window_argb_value = 50,
	own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
	border_inner_margin = 5,
	border_outer_margin = 0,
	gap_x = 0,
	gap_y = 0,
	draw_shades = false,
	draw_outline = false,
	draw_borders = false,
	draw_graph_borders = false,
	use_xft = true,
	font = 'Neon 80s:size=24',
	xftalpha = 0.8,
	uppercase = false,
	color = 'white',
	own_window_colour = '#000000',
	minimum_width = 300, minimum_height = 900,
	alignment = 'middle_middle',
    default_graph_height = 50,
    default_graph_width = 300
}; 
conky.text = [[

${color}${font}GPU: ${execp nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits}%
${color}${font}GPU Temp: ${nvidia gputemp}
${color}${font}GPU Temp Threshold: ${nvidia gputempthreshold}
${color}${font}GPU Ambient Temp: ${nvidia ambienttemp}
${color}${font}GPU Freq Min: ${nvidia gpufreqmin}${color}
${color}${font}GPU Freq Max: ${nvidia gpufreqmax}
${color}${font}GPU Freq: ${nvidia gpufreqcur}
${color}${font}GPU Clock Min: ${nvidia memfreqmin}
${color}${font}GPU Clock: ${nvidia gpufreqcur}
${color}${font}GPU: ${execgraph "echo $(nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits)" 40,100 ffff00 ff0000 -t}
]]
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 8
Level 8
Posts: 2067
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: NVidia GPU graph project need help please

Post by Koentje »

I'm in love! That chick can rock those drums! :shock:

But.. ehh.. what was the question again? :mrgreen:
Oh yes, borders..
You can now add those height,width values again.
And maybe change this to true? draw_borders = false, (think!)
Image
User avatar
Logansfury
Level 8
Level 8
Posts: 2346
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: NVidia GPU graph project need help please

Post by Logansfury »

Koentje wrote: Mon May 20, 2024 11:53 am I'm in love! That chick can rock those drums! :shock:

But.. ehh.. what was the question again? :mrgreen:
Oh yes, borders..
You can now add those height,width values again.
And maybe change this to true? draw_borders = false, (think!)
Stick a fork in this one!!

putting in the values did nothing, values and draw boarders = true gave me the boarders. I am watching my NVidia GPU graph fill up as we speak :)

Thank you so much Koentje :D
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 8
Level 8
Posts: 2067
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: NVidia GPU graph project need help please [SOLVED]

Post by Koentje »

Yeah i was afraid those height,width values did nothing... But you can set them in the settings part of conky.

Code: Select all

default_graph_height = 40,
default_graph_width = 100,
Image
User avatar
Logansfury
Level 8
Level 8
Posts: 2346
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: NVidia GPU graph project need help please [SOLVED]

Post by Logansfury »

Koentje wrote: Mon May 20, 2024 12:56 pm Yeah i was afraid those height,width values did nothing... But you can set them in the settings part of conky.

Code: Select all

default_graph_height = 40,
default_graph_width = 100,
I note that if the above code is present but dimensions are included in the ${graph} command, the values in the command take president and override the previously listed defaults.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
zcot
Level 9
Level 9
Posts: 2956
Joined: Wed Oct 19, 2016 6:08 pm

Re: NVidia GPU graph project need help please [SOLVED]

Post by zcot »

My answer is better. :P

because calling that exact same nvidia-smi command twice in a row instantly is an unnecessary load.

You've already been doing the simple script calls to drop the data to a file and grab it from conky. I don't see why this case should be different.

And that would've solved the convoluted mix of platform syntax error calls, and by proxy, fixed that issue for you.

Also, even if you get the syntax correct, there are almost no conky functions that allow recursive calls, -you can't use a call as a parameter in another call. Although there are templates for more complex setups, but then again this is not really one of those.

good job though, in the end. :lol:
User avatar
Koentje
Level 8
Level 8
Posts: 2067
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: NVidia GPU graph project need help please [SOLVED]

Post by Koentje »

I have told him that a 1000 times already.. if you have to use a program multiple times to get values. Run it once, drop all in a text file and cat that textfile. So i won't mention that anymore! :P
But to be honest i have no clue how heavy nvidia-smi is on the system?? Never had an NVidia card on my linux boxes..
I do know that radeontop is heavy and slooow! So i rather cat the info from the sysfs files.
Image
User avatar
Logansfury
Level 8
Level 8
Posts: 2346
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: NVidia GPU graph project need help please [SOLVED]

Post by Logansfury »

Koentje wrote: Mon May 20, 2024 7:14 pm I have told him that a 1000 times already.. if you have to use a program multiple times to get values. Run it once, drop all in a text file and cat that textfile. So i won't mention that anymore! :P
But to be honest i have no clue how heavy nvidia-smi is on the system?? Never had an NVidia card on my linux boxes..
I do know that radeontop is heavy and slooow! So i rather cat the info from the sysfs files.
This is the new Linux install on the laptop. It hasn't the Dell's minimalis with all the system calls. This is the only call of it's kind being executed by the laptop currently if I'm correct.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 8
Level 8
Posts: 2067
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: NVidia GPU graph project need help please [SOLVED]

Post by Koentje »

Yes but it begins with 'only' one.... then two... a week later 5... next month it's 10 programs called... and then you loose count and you wonder why your cpuload is so high!

Sounds familiar? :wink:
Image
User avatar
Logansfury
Level 8
Level 8
Posts: 2346
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: NVidia GPU graph project need help please [SOLVED]

Post by Logansfury »

zcot wrote: Mon May 20, 2024 7:02 pm My answer is better. :P

because calling that exact same nvidia-smi command twice in a row instantly is an unnecessary load.

You've already been doing the simple script calls to drop the data to a file and grab it from conky. I don't see why this case should be different.

And that would've solved the convoluted mix of platform syntax error calls, and by proxy, fixed that issue for you.

Also, even if you get the syntax correct, there are almost no conky functions that allow recursive calls, -you can't use a call as a parameter in another call. Although there are templates for more complex setups, but then again this is not really one of those.

good job though, in the end. :lol:
Thanks Zcot,

First step was to get it functional at all. Now that I have it set up I can relax and seek ways to make it less cpu intensive. In this case, it isn't a static info display, but a live update. With a graph that needs to update itself no longer than once every five seconds. Is there any difference between conky calling nvidia-smi on an execi 5 and having the system call it every 5 seconds to update a dump file for conky to read?
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 8
Level 8
Posts: 2346
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: NVidia GPU graph project need help please [SOLVED]

Post by Logansfury »

Here is the result of my reading the nvidia section of the conky manual:

Image

I redid the GPU section and swapped in some of the new values where they made the most sense in the original column. Temp Threshold, Clock Min, Freq, an Freq Min & Max + the GPU graph are added and now contribute to providing enough data to make a second column of GPU info to the left of the original display.

I know this thing is like the conky that ate Tokyo but I cannot help but be in love with it :D
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 8
Level 8
Posts: 2346
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: NVidia GPU graph project need help please [SOLVED]

Post by Logansfury »

HOLY CRAP!!

I just looked more closely at my screenshot above. I wanted the gpu graph to have something to bite on, so I started a youtube video of a bassist playing to rock song. The audio meter in this conky is showing active, displaying Chromium instance as source (I launched YouTube on chromium) and its displaying the band he is playing along with, the song, its duration, and the fact it's a cover of the song!!

This thing is UBER COOL!!!
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
Post Reply

Return to “Compiz, Conky, Docks & Widgets”