[Plugin] Linuxserver.io - Unraid Nvidia


Recommended Posts

On 4/9/2019 at 6:49 AM, uldise said:

any news on this?

I got the new card installed however I am getting the same error as with the GT710 the driver will not initialise.  when I boot directly into UnRaid it works, something in ESXi is blocking even tho I have passed through the hardware.

Link to comment
2 hours ago, IrishBiker said:

I got the new card installed however I am getting the same error as with the GT710 the driver will not initialise.  when I boot directly into UnRaid it works, something in ESXi is blocking even tho I have passed through the hardware.

Did you see my post a couple pages back:

Go to Settings > VM Options > Advanced > Edit Configuration > Add Parameter menu of the guest after powering it down and add the following parameter:


hypervisor.cpuid.v0 = "FALSE"

 


Seems to be somehow required for VMWare ESXI nvidia passthrough for CUDA and other advanced features to work.

 

Edited by Xaero
  • Like 1
Link to comment
57 minutes ago, Xaero said:

Did you see my post a couple pages back:

Go to Settings > VM Options > Advanced > Edit Configuration > Add Parameter menu of the guest after powering it down and add the following parameter:


hypervisor.cpuid.v0 = "FALSE"


 


Seems to be somehow required for VMWare ESXI nvidia passthrough for CUDA and other advanced features to work.

 

Ohhh, I missed that, it now seems I have a Nvidia gpu in UnRaid. Thanks a lot Xaero :)

gpu.jpg

Link to comment
1 hour ago, uldise said:

Glad you sorted it :) have this setting hypervisor.cpuid.v0 = "FALSE" any impact on performance of your unraid VM? 

Not that I have noted as yet. Did you notice any?

 

One thing Plex is still not using the graphics card. I've made the changes to the docker NVIDIA_DRIVER_CAPABILITIES (all)  and NVIDIA_VISIBLE_DEVICES (my GPU UUID) and enabled hardware transcoding in the plex menu but it still defaults to software.

 

Do I include the whole UUID string including the start of the string "GPU-"

Link to comment
4 minutes ago, CHBMB said:

Yes

 

That's why I printed the whole string in the plugin and why it shows it in the readme at the beginning of the thread ;)

 

Sent from my Mi A1 using Tapatalk

 

 

 

 

 

 

Just checking as that is what I have done, I've also tested with "all" and "0"

Link to comment

Have you checked the files you're trying to work with are supported by your card using the matrix here.
https://developer.nvidia.com/video-encode-decode-gpu-support-matrix

Looking at that your card doesn't support any H265 formats with 4:4:4 or VP8 for instance..

 

2019-04-13_10-53.thumb.png.a7036d2853b93e9b058e307deab61f3d.png
 

EDIT: Sorry that table is for encoding and you're tring to decode.  So supported better but still need to check your file type.

 

Sent from my Mi A1 using Tapatalk

Edited by CHBMB
Link to comment
3 hours ago, IrishBiker said:

Not that I have noted as yet. Did you notice any?

 

One thing Plex is still not using the graphics card. I've made the changes to the docker NVIDIA_DRIVER_CAPABILITIES (all)  and NVIDIA_VISIBLE_DEVICES (my GPU UUID) and enabled hardware transcoding in the plex menu but it still defaults to software.

 

Do I include the whole UUID string including the start of the string "GPU-"

Did you add the --runtime=nvidia part also? 

Link to comment
3 hours ago, saarg said:

If you copied/pasted the variables, try writing them in manually as there is a bug on the forum adding invisible characters when copying and pasting. 

I had cut and pasted them, so I deleted them and typed them in my hand and that seems to have got it active, well kinda. The film starts and I can see Plex is transcoding via the GPU however the CPU usage is quite high. This is just one stream.

 

 

Annotation 2019-04-13 212632 (2).jpg

Edited by IrishBiker
  • Like 1
Link to comment
8 hours ago, IrishBiker said:

I had cut and pasted them, so I deleted them and typed them in my hand and that seems to have got it active, well kinda. The film starts and I can see Plex is transcoding via the GPU however the CPU usage is quite high. This is just one stream.

 

 

Annotation 2019-04-13 212632 (2).jpg

By default, Plex only encodes with this unraid build and the GPU passed through. There's a way to enable decoding as well; but it is not officially supported by the Linuxserver.io, Plex, or unraid teams.

Here's a script I've modified that can be used via the user scripts plugin on a schedule to enable the decoding support:

https://gist.github.com/Xaero252/9f81593e4a5e6825c045686d685e2428

 

I will update that script as needed, until Plex adds official nvdec support.

 

Also note that nvenc and nvdec DO NOT offload audio transcoding. This generally is of no concern, unless you are dealing with lossless Atmos audio, which can be quite substantial to downmix and transcode.

  • Like 2
Link to comment
On 4/13/2019 at 3:34 PM, IrishBiker said:

I had cut and pasted them, so I deleted them and typed them in my hand and that seems to have got it active, well kinda. The film starts and I can see Plex is transcoding via the GPU however the CPU usage is quite high. This is just one stream.

 

 

Annotation 2019-04-13 212632 (2).jpg

I have a similar problem with High CPU usage. Ive enabled NDEC via the script. I can play a movie on plex and can see the processes on nvidia-smi. I can also confirm decoding via "nvidia-smi dmon -s u2.  Once its throttled I see very low CPU (3-4%).  Everything is perfect as long as I dont FF or RW the movie on plex. For every time I scroll on the time-bar of the movie on the plex app. CPU usage goes up as if it was a new software transcode.. after 4 or 5 times my CPU is at 100%.  Im using a Quadro P4000. 

Also the Processes on nvidia-smi dont die after I stop the movie.

Using linuxserver plex docker

Link to comment
50 minutes ago, rsampayo said:

I have a similar problem with High CPU usage. Ive enabled NDEC via the script. I can play a movie on plex and can see the processes on nvidia-smi. I can also confirm decoding via "nvidia-smi dmon -s u2.  Once its throttled I see very low CPU (3-4%).  Everything is perfect as long as I dont FF or RW the movie on plex. For every time I scroll on the time-bar of the movie on the plex app. CPU usage goes up as if it was a new software transcode.. after 4 or 5 times my CPU is at 100%.  Im using a Quadro P4000. 

Also the Processes on nvidia-smi dont die after I stop the movie.

Using linuxserver plex docker

Are you sure you are using the latest version of the script?

The inclusion of `exec` should let the processes die normally (and works as intended, from extensive testing) - indicating you may not have the correct wrapper script in use.
Second, when watching nvidia-smi dmon -s u; It is important to note that there are separate columns for different usage metrics. For example, there is a column for the gpu core itself, the "streaming multiprocessor" (sm), memory, the nvenc and nvdec pipes. The nvenc column only refers to encoding, while the nvdec column only refers to decoding. 

From there, keep in mind that with the latest version of the script and mpeg4 avi media, the card will only be used for encoding, as the decoder vomits on that particular type of media. 

I am using a Quadro P2000, for reference which is very closely related to your P4000. I will note that currently I have abysmal 4k transcoding performance for some unknown reason.

For example, here's my server currently:
image.thumb.png.d1a91eb2ebe34aabd977cf8b4985f17c.png

You can see my CPU usage is quite loaded - but the Plex Media Server and the transcoder are using barely any CPU.

This is because I'm currently converting ~1.8TB of *.7z archives to *.gz archives. You an also see there is a small amount of usage on the enc and dec side of the graphics card. It's a 1080p video being transcoded to 1080p; so the usage is low.

Once I close the browser tab with the video, the encode process drops off the GPU, but not until the tab is closed, or I stop that stream within the tab.
Edit2:
Yes, I know of tmux and screen - was just pulling up windows for demonstration, I don't normally monitor my server actively unless I'm trying to diagnose an issue lol

Edited by Xaero
Link to comment
36 minutes ago, Xaero said:

Are you sure you are using the latest version of the script?

The inclusion of `exec` should let the processes die normally (and works as intended, from extensive testing) - indicating you may not have the correct wrapper script in use.
Second, when watching nvidia-smi dmon -s u; It is important to note that there are separate columns for different usage metrics. For example, there is a column for the gpu core itself, the "streaming multiprocessor" (sm), memory, the nvenc and nvdec pipes. The nvenc column only refers to encoding, while the nvdec column only refers to decoding. 

From there, keep in mind that with the latest version of the script and mpeg4 avi media, the card will only be used for encoding, as the decoder vomits on that particular type of media. 

I am using a Quadro P2000, for reference which is very closely related to your P4000. I will note that currently I have abysmal 4k transcoding performance for some unknown reason.

For example, here's my server currently:
image.thumb.png.d1a91eb2ebe34aabd977cf8b4985f17c.png

You can see my CPU usage is quite loaded - but the Plex Media Server and the transcoder are using barely any CPU.

This is because I'm currently converting ~1.8TB of *.7z archives to *.gz archives. You an also see there is a small amount of usage on the enc and dec side of the graphics card. It's a 1080p video being transcoded to 1080p; so the usage is low.

Once I close the browser tab with the video, the encode process drops off the GPU, but not until the tab is closed, or I stop that stream within the tab.
Edit2:
Yes, I know of tmux and screen - was just pulling up windows for demonstration, I don't normally monitor my server actively unless I'm trying to diagnose an issue lol

 

Whats the latest version of the script?

The one I use is

 

#!/bin/sh

/usr/lib/plexmediaserver/Plex\ Transcoder2 -hwaccel nvdec "$@"

 

 

Here is an example of my problem. I scrolled the time bar on my iphone plex app 5 times and my Quadro got stuck at around 50% and my CPU was around 65%. I stop playing the file and it went down to 4-5% CPU and 0-2% GPU. But the Processes are still there.326674237_Screenshot2019-04-1421_15_42.thumb.png.04bd5ffd44637fc5e62c633a7d504a86.png

Thats more than 5 min later and they are still there.

 

1084429730_Screenshot2019-04-1421_22_06.png.b0c6063f253135646e033f58e703eef4.png

Link to comment
Just now, rsampayo said:

Whats the latest version of the script?

The one I use is

#!/bin/sh

/usr/lib/plexmediaserver/Plex\ Transcoder2 -hwaccel nvdec "$@"


I wrote a script that can be used to automatically re-apply the wrapper on a schedule so that when Plex is updated you don't have to manually re-apply the wrapper script.

That wrapper script is missing "exec"

See my gist post here:
https://gist.github.com/Xaero252/9f81593e4a5e6825c045686d685e2428

Lines 19-27 contain the wrapper script that executes the default "Plex Transcoder" which we move to "Plex Transcoder2"

You'll see there that I start each transcoder line with "exec"
To fix your wrapper (which would break with mpeg4 avi files):

#!/bin/sh
exec /usr/lib/plexmediaserver/Plex\ Transcoder2 -hwaccel nvdec "$@"

Link to comment
24 minutes ago, Xaero said:


I wrote a script that can be used to automatically re-apply the wrapper on a schedule so that when Plex is updated you don't have to manually re-apply the wrapper script.

That wrapper script is missing "exec"

See my gist post here:
https://gist.github.com/Xaero252/9f81593e4a5e6825c045686d685e2428

Lines 19-27 contain the wrapper script that executes the default "Plex Transcoder" which we move to "Plex Transcoder2"

You'll see there that I start each transcoder line with "exec"
To fix your wrapper (which would break with mpeg4 avi files):
 


#!/bin/sh
exec /usr/lib/plexmediaserver/Plex\ Transcoder2 -hwaccel nvdec "$@"

 

exec did the trick.

 

Xaero you made my weekend. Thanks.

 

Now to find out why we cant transcode 4k HEVC...

Link to comment

Hi guys.. just want to start by saying thanks for all your hard work enabling GPU hardware Transcoding on Plex and Emby. Absolutely Brilliant!

 

Now for the but.. need some help and advice.

 

I appear to have hit a strange issue and wanted to ask how I can help diagnose the issue?

 

I have hardware encoding enabled on Emby. Everything works perfectly. But every 24/48 hours the Docker Container just stops and I have to manually restart.

 

Restarting the docker isn't a huge deal, but it always appears to be stopped just when someone in the family is about to watch something.

 

For testing purposes, I removed the configuration for Emby for the GPU and it remains stable for days.  So something is triggering the docker to stop or crash.

 

I have also stopped Emby and tried Plex with the same issues and results.

 

Whilst I have searched logs in the docker for an indication as to why it crashes I cannot put my finger on the issue and decided to reach out here for help.

 

What can I provide the forum to help solve these issues, please? Happy to provide anything on my System to help fix the service on my Unraid machine.

 

I am not hugely technical, but happy to help in any way I can.

 

Thanks

Gary

titan-diagnostics-20190415-0940.zip

Edited by yakuzah
Link to comment

RIP.

I see you have PCIe ACS overrides enabled, a Windows 10 VM and then unraid is also reporting that there is no nvidia device available for the runtime. To my knowledge, if you are passing through your GPU to a VM and then also intending to use it with the docker, you are going to have a bad time.
When the GPU is handed over to the VM it's like it was physically unplugged from unraid, and then physically plugged into the VM. When the VM shuts down, the GPU gets plugged back into unraid, but the nvidia docker runtime doesn't know this until it's been restarted. Hence it working when you restart the docker.

Also, you usually shouldn't need to enable PCIe ACS overrides for passthrough unless some weird shenanigans are going on. 

EDIT:
I'm not exactly an expert on unraid/qemu/docker - just a general Linux junkie, I could be very wrong, but from glancing over your diagnostic logs that's what I'd assume is happening.

Edited by Xaero
post broke
Link to comment
  • trurl locked this topic
Guest
This topic is now closed to further replies.