NVIDIA / nvidia-container-toolkit

Build and run containers leveraging NVIDIA GPUs
Apache License 2.0
1.9k stars 214 forks source link

xorg can not running with GPU #286

Open SpringDay6 opened 2 years ago

SpringDay6 commented 2 years ago

I use CentOS 7.4 as the host and navida docker to run NVIDIA / CUDA 11.4.1-runtime-ubuntu 18.04.But I don't know how to make xorg use GPU

elezar commented 2 years ago

@SpringDay6 do you know which libraries on the host would be required to use the GPU from within the container. It could be that the container you are running is not setting the required NVIDIA_DRIVER_CAPABILITIES to ensure that the libraries are injected. The default is compute,utility. As a first step you could try to launch the container with NVIDIA_DRIVER_CAPABILITIES=all and then remove capabilities that are not required if these are a concern.

SpringDay6 commented 2 years ago

thank you!!! my xorg with the error 'Cannot open /dev/tty0' please help me @elezar I run the container with the command 'docker run -itd --gpus 'all,"capabilities=compute,utility,graphics,video,display"' nvidia/cuda:11.4.1-runtime-ubuntu18.04' then install xorg in the container and config xorg.conf. when I run xinit . it report the error Fatal server error: (EE) parse_vt_settings: Cannot open /dev/tty0 (No such file or directory) (EE) (EE) Please consult the The X.Org Foundation support at http://wiki.x.org for help. (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information. (EE) (EE) Server terminated with error (1). Closing log file. xinit: giving up xinit: unable to connect to X server: Network is unreachable xinit: server error

elezar commented 2 years ago

@SpringDay6 the errors that you show are unrelated to the NVIDIA Container Stack. Please ensure that you are able to run xorg in a container without using GPU support and then one can move from there to get GPU acceleration enabled.

That is to say, if you can get it to work with:

docker run -itd ubuntu:18.04

It should work for the NVIDIA image too once one adds the --gpus command line argument.

SpringDay6 commented 2 years ago

thank you very much!!!! @elezar maybe my xorg.conf is wrong. How to automatically generate xorg.conf in the NVIDIA Container ? I want to run the xorg with the GPU.(I have successfully run xorg in a container without using GPU support ) I can't find the command of 'nvidia-xconfig' in the container.It's only have nvidia-cuda-mps-control nvidia-cuda-mps-server nvidia-debugdump nvidia-detector nvidia-persistenced nvidia-smi

vaclavbenes commented 1 year ago

Hi @SpringDay6 , did you find solution on how to run xorg with GPU. I am also looking for nvidia-xconfig.

MiiW commented 3 months ago

Hi @SpringDay6 , did you find solution on how to run xorg with GPU. I am also looking for nvidia-xconfig.

Even when "display" driver capability is enabled, nvidia-xconfig binary still won't be copied to container's rootfs. After manually copy this binary into container, Xorg runs successfully. I've seen that binaries about Xorg are disabled in libnvidia-container by default. So, in above display case, what about enabling them? @elezar