Thank you so much for this. They only time I need my GPU in a higher power state is when it's transcoding video. Otherwise it's just at idle. So this script is great!
Thanks for pointing in the right direction! I have a 3080ti that I only really use for my gaming VM. I used a tplink energy monitor and was shocked to see that my machine was using ~180W at idle with no VM running. I discovered that if you simply run nvidia-persistenced, it will put the gpu in to the power saving mode. The script you've shared does look more robust though. I ended up adding a hook in /etc/libvirt/hooks/gpu_toggle and chmod +x that `gpu_toggle` file. This is the contents of my hook: ``` #!/bin/bash if [[ $2 == "prepare" ]] then echo "starting vm" kill -9 `pidof nvidia-persistenced` docker container stop Plex-Media-Server docker container start Plex-Media-ServerNO-GPU fi if [[ $2 == "release" ]] then echo "killing vm" nvidia-persistenced docker container stop Plex-Media-ServerNO-GPU docker container start Plex-Media-Server fi ``` This is a pretty rough script, but basically when a VM starts I kill persistenced, stop the Plex container that uses the GPU for transcoding and start one that does not use it. When the VM stops (releases), I start persistenced and the container that uses the gpu. I haven't passed through my GPU obviously, but it is still working well with my VM. With this config, I can get the most out of it while saving a lot of energy. The machine now runs at 80W at idle when the VM is not running.
Did I miss something? To have a gaming VM, I had to isolate my GPU to use it with passthrough. So this GPU is no longer visible to the Nvidia driver plugin. Is it possible to create a VM with a GPU without passthrough?
Thanks for that, 24 watts down to 7watts on an Nvidia GTX1660Ti. The only thing that threw me was the much bigger script on your GitHub. I see that much of the extra is to do with the power calculator.
There is a much more simple script you could have used: #!/bin/bash #nvidia-smi --persistence-mode=1 nvidia-persistenced fuser -v /dev/nvidia* and set to first start of array. nothing to run hourly.
Any tips on improving power for stubbed GPUs that are passed through to VMs? My guess is unraid isn't able to do anything with those since they are disabled in the VFIO config.
i am doing crypto mining on windows VM, just install MSI afterburner as example and lower the power, increase memory etc. If they are passed through, you manage them on the new OS without any issues.
Hi Jason. Yes when stubbed Unraid cant manage the device. The guest OS will manage the device (an its power) when passed through. So when the VM is stopped the GPU will not have efficient power management. However you dont have to stub the GPU to pass it through (normally you dont anyway) so then when the VM is off Unraid can manage it. If you have to stub it I would suggest not turning off the VM as then you will get better power efficiency than you would if you shutdown the VM
@@SpaceinvaderOne I found with my gtx 960 I was passing through to a windows 10 vm I had to stub it or the nvidia driver would not let go of it crashing th vm manager if you don't normally need to stub them any idea why I do?
nice vid love these kind of tweaks only thing is line 17 of the script i had to change "pid" to pid otherwise it wouldn't work for me because "pid" wasn't valid in Nvidia-SMI anymore using unraid 6.12.6
Setting the persistence mode via nvidia-smi is deprecated functionality by nvidia. It still works (for now), but the correct way to persist the driver now is using nvidia-persistenced.
I didnt think i would notice muh differnce but i do they even run cooler which is great. running a Quadro p2000 and a RTX 3080 TI. temp has dropped at least 5 degrees. cheers for this.
Isn t installing the Nvidia drivers in contradiction of the procedure of passing through the device at first place? If i can recall main purpose of passing through something is the main hypervisor doesn t use it at all (so it doesn t load any drivers) in order for the card to be available to be passed through.
I have a friends EVGA 1080 Hybrid that has been reporting around 15w at ideal since I installed it. Running the script didn't change anything but I figure the power usage is due to the fan and pump that are running off the card. Either way I can't complain as the card only cost me access to Plex. Still going to have the script set up to run hourly, thanks for the videos as always.
My graphics card always shows 1 process running but card at idle I think its taking over as the primary video even though I run the server as a headless setup the quadro m2000 is only used for transcoding plex is there a way to not have it selected as the primary video device
I learned about userscripts and the likes, but the power saving didn't work in my system. Dual Xeon x5690's so I'm hardly going to notice 20W from a GPU :( The SAS array drives consume more than the GPU. Might be time to invest in some more solar panels!
hello, I would like to make it possible to connect to the nas with folders inside even from outside the home, that is, remotely but since they removed the openvpn-as plugin I don't know how to do this anymore, can you help me please, I need detailed instructions . I immediately thank those people who will help me. It is urgent.
I feel like this is a stupid question, but here it goes... Does this apply to devices passed through to a VM? I suppose unRAID couldn't see them for the driver to make a difference?
Hi Britton. No thats not a stupid question at all. Yes whilst the GPU is being passed through to a VM then Unraid cant see or manage it. During this time it will be managed by the guest OS. When the VM is stopped and its passed back to the host then the host will manage the device. The exception is if the device has been stubbed (bound to VFIO) then Unraid has no access to the device at all. Thanks for watching :)
So if it’s been stubbed (bound to VFIO) will the graphics card by default be in power save mode when I’m not running the VM? Or how would I be able to put the card in power save mode in that case?
Hi! I've been watching your channel for a while now with unraid. I understand this is an old video, but could you tell me why this might also be causing my ollamabackend container to also keep crashing? Do you think this is related or no?
amazing thank you, wasn't worried so much about the power but my A2000 was sitting at 60 degrees (idol) running your script has dropped the temp right down
my gpu does sadly not report power consumption and i dont see anything in Unraid to display overall power consumption. would be great if someone could help me im pretty new in unraid and even google didnt display any useful information exept for this video
@@pedrovillalobos9859 i have the Nvidia Quadro P400 and i just did like in the video. the gpu reports Load,Temperature and Processes but no power usage
That script looks a lot more involved than the one I'm using, I tagged you in a thread on the unRAID forums for that, can you check that and let me know what you think? After 12 days of uptime the GPU enters and exit throttling mode correctly with the one in that forum post.
Thank you again! Could you make a tutorial how to run an unraid Server without any GPU / or iGPU? In my case I run a 10500f without any gpu and my old gtx 760 is still to powerhungry
My GTX 1080 was showing 19W, yet my NUT UPS display was showing I was pulling 125W total. After running the script I saw the power state dropped from P5 to P8, and instead of 19W it was pulling 12W. The overall UPS power draw now showed 72W. Thanks... I'll keep that 53W power savings.
Wouldn't this script kill any transcoding processes when it runs. Isn't it better to just enable persistence mode and let that handle the power states. From personal testing I found it stays in state P0 for only a few minutes after finishing whichever tasks it was doing. Then quickly scales down to power state P8. Then it scales up to P0 for any demanding enough task. Basically I run at startup of the array #!/bin/bash nvidia-persistenced --verbose nvidia-smi -pl 175 The pl just applies an upper power limit. It's just a nicety
The script checks if any processes are using the GPU on Unraid (ie transcoding) and if a process is active it will not change anything so not kill any transcodes.
His latest script checks for processes using a pid check. If you have the original script (which will automatically kill all running processes) you will need to copy and paste the newer script.
Is it possible to lower the max power usage of an nvidia gpu? My powersupply is 75W less powerrful than it has to be. Or I did something wrong. Xeon 2288g 8x 18TB Exos, 2 nvme, quadro rtx 5000. Seasonic px fanless 450
Hi Spaceinvader, I hope you can help because I have no idea who else to ask, when I try to use my Vive Pro 2 in a VM, I can't see the Ultra or Extreme modes for the higher resolutions. I appreciate you may not own a VP2 but I'd be so grateful if you have any ideas where I should start!? Thanks for this video, too - it will surely help once again! Many thanks in advance just for reading! :)
@@SpaceinvaderOne looks like 9 watts was it’s idle state. The nvidia drivers were doing it automatically. However, after the most recent Unraid version or the new nvidia drivers, idle wasn’t coming on automatically so I have set up the script and it’s working a treat! Thanks spaceinvaderone, I’m a new Unraid user and your videos are entertaining and informative, loving this new hobby!
Commenting it here as I basically reset my whole VMs for not knowing what the issue was and I was only able to get it back to working properly once I had removed the NVidia drivers from Unraid: You CAN have NVidia drivers installed on Unraid, just know that when you connect to a Windows VM (Windows 11 Pro with Parsec or RDP on my case), you might see a black screen that won't go away. It's not the same black screen as when you are trying to boot without GPU's bios. I just disconnect and reconnect to the VM (RDP or Parsec) and it all works WITH the gpu.
Hey so does this power saving tip also work when you pass through the graphics card to a VM? Seems like there’s issues when you pass it through and install the Nvidia drivers?
Yes you can do this and passthrough the same GPU. Powersaving will happen when the VM is not running. The script running once an hour checks the powerstate and if vm not running it will chnage it into a low power state
@@danielcollins7714 No if the GPU is bound to VFIO then Unraid doesnt have access to the device itself even when the VM is not running. In that case its best to leave the VM always running so the card gets power management from the guest OS. However you don't have to (in most cases) stub the card for passthrough.
Yeah its a good power saving. 1.2 kwh a day saving (here in UK my power is £0.38 kwh) over a year will save me £138. Wow your server is super efficient thats great, I wish my server was a bit more power efficient. Thanks for watching :)
Someone should do the math here… how much will we save per month (I’m guessing it’s not more than a buck or two) - and how long will it take to pay for $1000+ for a couple of Nvidia graphics cards? Even if you save $5/month (very unlikely), it would still take over 16 YEARS to pay for those video cards.
wow, went from 115w to 15w with a 3080ti, lifesaver! THANK YOU!
Thank you so much for this. They only time I need my GPU in a higher power state is when it's transcoding video. Otherwise it's just at idle. So this script is great!
Tak!
Ed, thank you! I always thought my GTX 970 was using too much power on unraid.
Thanks again
Your welcome Ben. Thanks for watching :)
Thanks Ed :)
Every little bit helps, this is saving me about €60 per year. Dropped from 43W to 20W on my Quaddro M4000
Thanks for pointing in the right direction!
I have a 3080ti that I only really use for my gaming VM. I used a tplink energy monitor and was shocked to see that my machine was using ~180W at idle with no VM running.
I discovered that if you simply run nvidia-persistenced, it will put the gpu in to the power saving mode. The script you've shared does look more robust though.
I ended up adding a hook in /etc/libvirt/hooks/gpu_toggle and chmod +x that `gpu_toggle` file. This is the contents of my hook:
```
#!/bin/bash
if [[ $2 == "prepare" ]]
then
echo "starting vm"
kill -9 `pidof nvidia-persistenced`
docker container stop Plex-Media-Server
docker container start Plex-Media-ServerNO-GPU
fi
if [[ $2 == "release" ]]
then
echo "killing vm"
nvidia-persistenced
docker container stop Plex-Media-ServerNO-GPU
docker container start Plex-Media-Server
fi
```
This is a pretty rough script, but basically when a VM starts I kill persistenced, stop the Plex container that uses the GPU for transcoding and start one that does not use it.
When the VM stops (releases), I start persistenced and the container that uses the gpu.
I haven't passed through my GPU obviously, but it is still working well with my VM. With this config, I can get the most out of it while saving a lot of energy. The machine now runs at 80W at idle when the VM is not running.
Did I miss something?
To have a gaming VM, I had to isolate my GPU to use it with passthrough. So this GPU is no longer visible to the Nvidia driver plugin.
Is it possible to create a VM with a GPU without passthrough?
Yep, I have no problem doing it without passing through the GPU
Easily the best tutorials ive seen. Subscribed
Amazing! my GTX 1060 was spinning very loud, even at idle. This made perfect!
so if the gpu is lets say transcoding and then the hourly script hits will it just go back into a transcode power mode?
Ed I have always enjoyed your videos and thank you greatly for your videos. Cheers!
Thanks for that, 24 watts down to 7watts on an Nvidia GTX1660Ti. The only thing that threw me was the much bigger script on your GitHub. I see that much of the extra is to do with the power calculator.
Thanks so much for another awesome video keep up the wonderful work!! Cheers
Thanks!! My 3060ti went from 54 watts at idle to 11.
Great 2 minute tip Ed! Will be installing the script.
There is a much more simple script you could have used:
#!/bin/bash
#nvidia-smi --persistence-mode=1
nvidia-persistenced
fuser -v /dev/nvidia*
and set to first start of array. nothing to run hourly.
Thank you for the video like always. But could you please share more details about script and what it actually do with GPU???
Nice timing and vid. 2nd result on a google search. 👍
Went from 66-70W on the gpu to 15-15 W. very nice thx :)
Mad love bro!!!! THANK YOU VERY MUCH MAN!!!!!
Any tips on improving power for stubbed GPUs that are passed through to VMs? My guess is unraid isn't able to do anything with those since they are disabled in the VFIO config.
i am doing crypto mining on windows VM, just install MSI afterburner as example and lower the power, increase memory etc. If they are passed through, you manage them on the new OS without any issues.
Hi Jason. Yes when stubbed Unraid cant manage the device. The guest OS will manage the device (an its power) when passed through. So when the VM is stopped the GPU will not have efficient power management. However you dont have to stub the GPU to pass it through (normally you dont anyway) so then when the VM is off Unraid can manage it. If you have to stub it I would suggest not turning off the VM as then you will get better power efficiency than you would if you shutdown the VM
@@SpaceinvaderOne I found with my gtx 960 I was passing through to a windows 10 vm I had to stub it or the nvidia driver would not let go of it crashing th vm manager if you don't normally need to stub them any idea why I do?
I have a few GPUs passed through to VMs. None draw any additional power
Great Vid as ever! Just need you to dig into PowerTop now ;)
nice vid love these kind of tweaks only thing is line 17 of the script i had to change "pid" to pid otherwise it wouldn't work for me because "pid" wasn't valid in Nvidia-SMI anymore using unraid 6.12.6
Setting the persistence mode via nvidia-smi is deprecated functionality by nvidia. It still works (for now), but the correct way to persist the driver now is using nvidia-persistenced.
I didnt think i would notice muh differnce but i do they even run cooler which is great. running a Quadro p2000 and a RTX 3080 TI. temp has dropped at least 5 degrees. cheers for this.
Isn t installing the Nvidia drivers in contradiction of the procedure of passing through the device at first place? If i can recall main purpose of passing through something is the main hypervisor doesn t use it at all (so it doesn t load any drivers) in order for the card to be available to be passed through.
Cheers! My 970 went down from 50W to 22W. I guess the new GPUs are even more efficient.
GTX1050 that's been unlocked, of course it doesn't show power usage but I know it's power state doesn't drop properly - thanks for the script!
I have a friends EVGA 1080 Hybrid that has been reporting around 15w at ideal since I installed it. Running the script didn't change anything but I figure the power usage is due to the fan and pump that are running off the card. Either way I can't complain as the card only cost me access to Plex. Still going to have the script set up to run hourly, thanks for the videos as always.
Thanks for the video and script ❤️
My pleasure. Thanks for watching :)
This works great! Thank you!
Even my 1050ti now needs 10W less. Thanks for your videos!!!
What does it do if the GPU is in use when the script runs? Does it just ignore the script and keep working on whatever task it's been assigned?
Good question, and one I'm also curious about.
I guess we can't use this for passthrough gpus or devices assigned to a vm
HUGE! Thanks!
My graphics card always shows 1 process running but card at idle
I think its taking over as the primary video even though I run the server as a headless setup
the quadro m2000 is only used for transcoding plex
is there a way to not have it selected as the primary video device
What is SteamDeck TrueNas script?
Could do with a scrypt for AMD
Will this cause any issues if it runs during a transcoded?
As always Ed, great work! Lifesaver.
I have Ollama docker running by joly0 and notice the script also shuts down that container.
any suggestions?
Thanks!,, what did you use to check the total power usage? and also how do you display the fan speed on dashboard?
Power usage is from a sonoff plug flashed with tasmota firmware. Fan on dashboard is from cpu temperature plugin (also shows fans with that)
@@SpaceinvaderOne Ahh, thanks. I have that plugin. It doesn't show my fans on the settings. I'd guess they're too basic.
Any hacks on a Threadripper PRO?
I’m pulling 270w (6 drives, 2 GPUs) and since the electric prices have doubled, it’s killing me!
I learned about userscripts and the likes, but the power saving didn't work in my system. Dual Xeon x5690's so I'm hardly going to notice 20W from a GPU :( The SAS array drives consume more than the GPU. Might be time to invest in some more solar panels!
Awesome and thanks!!
hello, I would like to make it possible to connect to the nas with folders inside even from outside the home, that is, remotely but since they removed the openvpn-as plugin I don't know how to do this anymore, can you help me please, I need detailed instructions . I immediately thank those people who will help me. It is urgent.
Server unraid
I feel like this is a stupid question, but here it goes... Does this apply to devices passed through to a VM? I suppose unRAID couldn't see them for the driver to make a difference?
Hi Britton. No thats not a stupid question at all. Yes whilst the GPU is being passed through to a VM then Unraid cant see or manage it. During this time it will be managed by the guest OS. When the VM is stopped and its passed back to the host then the host will manage the device. The exception is if the device has been stubbed (bound to VFIO) then Unraid has no access to the device at all. Thanks for watching :)
Presumably if it is passed through to a VM, the nVidia driver inside the VM will correctly set the power profile?
So if it’s been stubbed (bound to VFIO) will the graphics card by default be in power save mode when I’m not running the VM? Or how would I be able to put the card in power save mode in that case?
Good video Ed! Thanks for always sharing with us!👍💖😎JP
Your welcome. Thanks for watching :)
Hi! I've been watching your channel for a while now with unraid. I understand this is an old video, but could you tell me why this might also be causing my ollamabackend container to also keep crashing? Do you think this is related or no?
thanks! you are the best.
Thank you very much!!!
amazing thank you, wasn't worried so much about the power but my A2000 was sitting at 60 degrees (idol) running your script has dropped the temp right down
Great Tip!
my gpu does sadly not report power consumption and i dont see anything in Unraid to display overall power consumption. would be great if someone could help me im pretty new in unraid and even google didnt display any useful information exept for this video
Which GPU do you have? Are all the drivers properly installed?
@@pedrovillalobos9859 i have the Nvidia Quadro P400 and i just did like in the video. the gpu reports Load,Temperature and Processes but no power usage
That script looks a lot more involved than the one I'm using, I tagged you in a thread on the unRAID forums for that, can you check that and let me know what you think? After 12 days of uptime the GPU enters and exit throttling mode correctly with the one in that forum post.
Can you link the thread here?
I would also like a link to the thread
Will this also work for a GPU that has been assigned to a VM?
THANK YOU!!!!
Thank you again! Could you make a tutorial how to run an unraid Server without any GPU / or iGPU? In my case I run a 10500f without any gpu and my old gtx 760 is still to powerhungry
My GTX 1080 was showing 19W, yet my NUT UPS display was showing I was pulling 125W total. After running the script I saw the power state dropped from P5 to P8, and instead of 19W it was pulling 12W. The overall UPS power draw now showed 72W. Thanks... I'll keep that 53W power savings.
thanks you helped me with the lodged for jay
Your welcome mind craft. Thanks for watching :)
Love you!
why cant unraid do that on its own? or is it the drivers fault?
Wouldn't this script kill any transcoding processes when it runs. Isn't it better to just enable persistence mode and let that handle the power states.
From personal testing I found it stays in state P0 for only a few minutes after finishing whichever tasks it was doing. Then quickly scales down to power state P8. Then it scales up to P0 for any demanding enough task.
Basically I run at startup of the array
#!/bin/bash
nvidia-persistenced --verbose
nvidia-smi -pl 175
The pl just applies an upper power limit. It's just a nicety
The script checks if any processes are using the GPU on Unraid (ie transcoding) and if a process is active it will not change anything so not kill any transcodes.
@@SpaceinvaderOne ah okay
His latest script checks for processes using a pid check. If you have the original script (which will automatically kill all running processes) you will need to copy and paste the newer script.
@@SpaceinvaderOne in that case I could have a custom cron invervall to execute the script every 15 minutes. :)
Is it possible to lower the max power usage of an nvidia gpu?
My powersupply is 75W less powerrful than it has to be.
Or I did something wrong.
Xeon 2288g 8x 18TB Exos, 2 nvme, quadro rtx 5000.
Seasonic px fanless 450
Hi Spaceinvader, I hope you can help because I have no idea who else to ask, when I try to use my Vive Pro 2 in a VM, I can't see the Ultra or Extreme modes for the higher resolutions. I appreciate you may not own a VP2 but I'd be so grateful if you have any ideas where I should start!? Thanks for this video, too - it will surely help once again! Many thanks in advance just for reading! :)
Is it worth me doing it? The GPUs (gtx 1060) says around 9watts at idle using the statistics
Yeah 9 watts isn't alot. But you have nothing to loose using it.
@@SpaceinvaderOne looks like 9 watts was it’s idle state. The nvidia drivers were doing it automatically. However, after the most recent Unraid version or the new nvidia drivers, idle wasn’t coming on automatically so I have set up the script and it’s working a treat! Thanks spaceinvaderone, I’m a new Unraid user and your videos are entertaining and informative, loving this new hobby!
Commenting it here as I basically reset my whole VMs for not knowing what the issue was and I was only able to get it back to working properly once I had removed the NVidia drivers from Unraid:
You CAN have NVidia drivers installed on Unraid, just know that when you connect to a Windows VM (Windows 11 Pro with Parsec or RDP on my case), you might see a black screen that won't go away.
It's not the same black screen as when you are trying to boot without GPU's bios. I just disconnect and reconnect to the VM (RDP or Parsec) and it all works WITH the gpu.
Hey so does this power saving tip also work when you pass through the graphics card to a VM? Seems like there’s issues when you pass it through and install the Nvidia drivers?
Thanks!
Welcome! Thanks for watching :)
Is there a way to do this even when the GPU is passed through to a VM sometimes?
Yes you can do this and passthrough the same GPU. Powersaving will happen when the VM is not running. The script running once an hour checks the powerstate and if vm not running it will chnage it into a low power state
@@SpaceinvaderOne even if the GPU IOMMU is bound to VFIO at boot?
@@danielcollins7714 No if the GPU is bound to VFIO then Unraid doesnt have access to the device itself even when the VM is not running. In that case its best to leave the VM always running so the card gets power management from the guest OS. However you don't have to (in most cases) stub the card for passthrough.
In which cases would you have to stub through the card?
i notice you still do hard work on this script. i just borrowed a old Quadro 2000 to check this feature. 🙂
feature is ok, but the fan from the old quadro spinning on high rpm, too high. :-(
Loving this. too bad i have no gpu's that are not assigned.
Thanks! Does this script have any effect on gpu pass-through to a vm? Is it still possible or does it lead to conflicts?
Yep fine to use if you have passthough. It will save power whilst the VM is off. When VM is running the vms OS will manage the power.
wow dropped my 3060ti from 47 to 24. Awesome
Got my GPU's idle powerdraw to drop from like 90w to 7W
What gpu are you using ?
Thanks for the video! What are you using to check the system power consumption? Is that a plug-in?
From one of his comments to another similar question:
"The power usage if from a Sonoff Pow R2 smartplug flashed with tasmota firmware"
this dropped my idle on 1660ti to single digits, thanks @spaceinvader
Make sure you're running Balanced power state rather than Performance...
How about AMD users??
I would like to see the actual wattage at the wall difference using something like a kill-a-watt/ smart plug
Didn't he do exactly that?
The power usage if from a Sonoff Pow R2 smartplug flashed with tasmota firmware
I have script just with nvidia persistance mode 1, just one row
Have a 1660 Super & 3050, saved about 40W
AMD GPU please
50w is 1200kwh per day , 438kwh per year ! almost half a megawatt . (my unraid server runs between 17 and 24 watt , i use an atom based pc )
*1.2kWh pr day.
Yeah its a good power saving. 1.2 kwh a day saving (here in UK my power is £0.38 kwh) over a year will save me £138. Wow your server is super efficient thats great, I wish my server was a bit more power efficient. Thanks for watching :)
my p400 saved 8w, thanks.
i wish i watched this fully year ago , from 50watt idil to 8watt
A year later, this is still a problem apparently. Anyway, thank you!
X99 Mainbaords laufen auch Ohne Grafikarte ohne IGPU
click video - like video - watch video.
:)
Hey
😀
Hey run this script I made without explaining what it does.....
THANKS 3080
Someone should do the math here… how much will we save per month (I’m guessing it’s not more than a buck or two) - and how long will it take to pay for $1000+ for a couple of Nvidia graphics cards? Even if you save $5/month (very unlikely), it would still take over 16 YEARS to pay for those video cards.
This is for people who already have an Nvidia gpu in their server. It isnt a suggestion to buy a new GPU :)
Thanks 👍
Your welcome :)