tom472 / mediabox

Container based media tools configuration
MIT License
428 stars 83 forks source link

GPU support for plex docker #89

Open wibuf opened 5 years ago

wibuf commented 5 years ago

Is Nvidia GPU support possible to add to the plex docker?

Thanks

tom472 commented 5 years ago

Hey @wibuf

There is actually a pull request in for this via: https://github.com/tom472/mediabox/pull/73 The issue is if you do not have a DRI device available but the PLEX section of the yaml file is looking to map it then the container fails to start.

I am trying to work out a way to see if the user has a device available or not and only add the mapping for it in the yaml file if it is available.

So it is being looked into I just haven't found the 'right' way to do it yet.

wibuf commented 5 years ago

Okay, since I know I have a device available, is there a way to edit the plex docker to use it now instead of waiting for the device check code to be done? Thanks

tom472 commented 5 years ago

You will need to edit the docker-compose.yml file and add this to the PLEX section:

devices: - '/dev/dri:/dev/dri'

The spacing is very important, it should look like what is shown here after adding it in: https://github.com/tom472/mediabox/pull/73/files

wibuf commented 5 years ago

Where's that file located? I've been trying to make changes in portainer itself.

tom472 commented 5 years ago

That file should be right inside the mediabox folder. If you need to know exactly where that folder is you can open the Mediabox landing page on your Mediabox PC, click on the Mediabox icon and scroll down to the "Troubleshooting" section. To locate where your mediabox folder is look at the value of: PWD in that section.

wibuf commented 4 years ago

Does this change require a full restart or just the plex docker? I still can't get the GPU to transcode with plex, but I got it working fine with emby

Here's my docker-compose.yml, I copied and pasted right from the link you posted: https://i.imgur.com/dZD8qSo.png

tom472 commented 4 years ago

@wibuf I'll have to get back to you on this... but I'm going to be away for a bit so it will have to wait until I get back.

--Tom

wibuf commented 4 years ago

Still working on this. Think I'm a bit closer. I tried running nvidia-smi -L in the plex container console and get the error: bash: nvidia-smi: command not found

Led me to here: https://github.com/NVIDIA/nvidia-docker/issues/341

I think I'm missing something in the docker-compose Need to figure out how to add the devices

Should I try using docker-nvidia? https://www.funkypenguin.co.nz/note/gpu-transcoding-with-emby-plex-using-docker-nvidia/ https://github.com/NVIDIA/nvidia-docker

tom472 commented 4 years ago

You should not need nvidia-docker - What to you get if you do $ ls -lah from the /dev/dri folder on your host PC?

wibuf commented 4 years ago

/dev/dri$ ls -lah total 0 drwxrwxrwx 3 root root 120 Sep 9 00:20 . drwxr-xr-x 19 root root 4.1K Sep 9 00:20 .. drwxrwxrwx 2 root root 100 Sep 9 00:20 by-path crwxrwxrwx 1 root video 226, 0 Sep 9 00:20 card0 crwxrwxrwx 1 root video 226, 1 Sep 9 00:20 card1 crwxrwxrwx 1 root video 226, 128 Sep 9 00:20 renderD128

jam3srox commented 4 years ago

Im having issues getting HW transcoding working in Plex it just continues to do CPU transcoding. I've added the device to the docker-compose.yml file exactly as suggested.

        hostname: ${HOSTNAME}
        devices:
            - '/dev/dri:/dev/dri'
        volumes:
            - './plex:/config'

My /dev/dri directory is the exact same as above minus card1.

root@media:/dev/dri# ls -lah
total 0
drwxr-xr-x  3 root root       100 Dec 19 16:09 .
drwxr-xr-x 19 root root      4.2K Dec 19 16:13 ..
drwxr-xr-x  2 root root        80 Dec 19 16:09 by-path
crw-rw----  1 root video 226,   0 Dec 19 16:09 card0
crw-rw----  1 root video 226, 128 Dec 19 16:09 renderD128

The drivers are installed for the card and it looks to be working.

media@media:~/mediabox$ nvidia-smi -L
GPU 0: GeForce GTX 1650 SUPER (UUID: GPU-b2d3cb0a-8261-1ac3-88fd-ccb00cba11fe)
media@media:~/mediabox$ nvidia-smi
Thu Dec 19 19:00:04 2019
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.44       Driver Version: 440.44       CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 165...  Off  | 00000000:25:00.0 Off |                  N/A |
| 32%   30C    P0    13W / 100W |      0MiB /  3909MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

Any help or suggestions would be appreciated.

wibuf commented 4 years ago

I went through the same and never was able to get it working.

wibuf commented 4 years ago

Been doing more research on this. Looks like its an issue between Nvidia-container-toolkit, Docker 19.03+ and Portainer: https://github.com/portainer/portainer/issues/3143

Won't have a fix for awhile: Not scheduled for development until later this year (post July).

I have not been able to get any workarounds to work successfully. Would probably need to abandon portainer for the plex docker, and use docker2 to get it working successfully.

This should work: docker run \ -d \ --name plex \ --network=pub_net \ --ip=192.168.1.25 \ --gpus all \ -e TZ= \ -e PLEX_CLAIM="" \ -e NVIDIA_VISIBLE_DEVICES="all" \ -e NVIDIA_DRIVER_CAPABILITIES="compute,video,utility" \ -h \ -v /local1/plex/plexdata:/config \ -v /local1/plex/transcode:/transcode \ -v /mnt/media:/data \ --device /dev/dri:/dev/dri \ plexinc/pms-docker:plexpass