{"id":20957335,"url":"https://github.com/abcdesktopio/gpu","last_synced_at":"2026-03-15T19:40:21.691Z","repository":{"id":192387787,"uuid":"621520572","full_name":"abcdesktopio/gpu","owner":"abcdesktopio","description":"enable nvidia gpu device to X.org ","archived":false,"fork":false,"pushed_at":"2023-09-14T14:21:21.000Z","size":4682,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-12-26T08:35:39.968Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abcdesktopio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-30T20:41:11.000Z","updated_at":"2023-03-30T20:41:11.000Z","dependencies_parsed_at":"2024-11-19T01:41:53.418Z","dependency_job_id":"5712978c-8499-416b-ad12-00ada0e8c98f","html_url":"https://github.com/abcdesktopio/gpu","commit_stats":null,"previous_names":["abcdesktopio/gpu"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/abcdesktopio/gpu","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abcdesktopio%2Fgpu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abcdesktopio%2Fgpu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abcdesktopio%2Fgpu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abcdesktopio%2Fgpu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abcdesktopio","download_url":"https://codeload.github.com/abcdesktopio/gpu/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abcdesktopio%2Fgpu/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30550523,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-15T15:03:43.933Z","status":"ssl_error","status_checked_at":"2026-03-15T15:03:37.630Z","response_time":61,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T01:31:51.389Z","updated_at":"2026-03-15T19:40:21.671Z","avatar_url":"https://github.com/abcdesktopio.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"## Description\n\nThis document is a craftpad to enable and share nvidia devices in kubernetes container \n\n## Goal\n\nRun application like with nvidia support inside a container \n- glxgear\n- chimestrax\n- others 3D applications\n\n\n## Issues\n\n- Start more than one graphical container into the host \n- Read \nhttps://forums.developer.nvidia.com/t/nvidia-gpu-0-failed-to-acquire-modesetting-permission/213267/4\n\n## Install \n\n### Def\n\n#### what is `headless` ?\n\nThe term `headless` refers to a configuration in which the GPU does not send display information to a display monitor\n\n#### what is `dkms` \nDynamic Kernel Module Support (DKMS) is a program/framework that enables generating Linux kernel modules whose sources generally reside outside the kernel source tree. The concept is to have DKMS modules automatically rebuilt when a new kernel is installed.\n\n\n## Design test-1\n\nThe host is a vm Ubuntu 20.04\n\n![gpu-abcdesktop-desing-test-1](gpu-abcdesktop-infra.svg)\n\n\n### Install\n\nInstall on Ubuntu 22.04, quick and dirty guide\n\n\n#### Install NVIDIA Device Plugin\n\n##### Blacklist nouveau \n\n```\necho blacklist nouveau \u003e /etc/modprobe.d/blacklist-nvidia-nouveau.conf\necho options nouveau modeset=0 \u003e\u003e /etc/modprobe.d/blacklist-nvidia-nouveau.conf\n```\n\n- Reboot after update-initramfs \n```\nupdate-initramfs -u\nreboot\n```\n\n##### Install  nvidia-container-toolkit-base \n\nAdd nvidia-docker in repo\n\n```\nwget https://nvidia.github.io/nvidia-docker/gpgkey --no-check-certificate\napt-key add gpgkey\ndistribution=$(. /etc/os-release;echo $ID$VERSION_ID)\ncurl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list\nsudo apt-get update \u0026\u0026 sudo apt-get install -y nvidia-container-toolkit-base\n```\n\n##### Install `cuda` package\n\n\nSource https://developer.nvidia.com/cuda-downloads\nSource https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html\n\n```\nwget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb\ndpkg -i cuda-keyring_1.1-1_all.deb\napt-get update\napt-get -y install cuda\n```\n\n- run `nvidia-smi` command\n\n```\nnvidia-smi\n```\n\n```\nThu Sep 14 11:46:00 2023 \n+---------------------------------------------------------------------------------------+\n| NVIDIA-SMI 535.104.05             Driver Version: 535.104.05   CUDA Version: 12.2     |\n|-----------------------------------------+----------------------+----------------------+\n| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |\n| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |\n|                                         |                      |               MIG M. |\n|=========================================+======================+======================|\n|   0  NVIDIA GeForce GTX 1070        Off | 00000000:03:00.0 Off |                  N/A |\n| 27%   32C    P0              35W / 180W |      0MiB /  8192MiB |      1%      Default |\n|                                         |                      |                  N/A |\n+-----------------------------------------+----------------------+----------------------+\n                                                                                         \n+---------------------------------------------------------------------------------------+\n| Processes:                                                                            |\n|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |\n|        ID   ID                                                             Usage      |\n|=======================================================================================|\n|  No running processes found                                                           |\n+---------------------------------------------------------------------------------------+\n```\n\n##### Install `containerd` and `kubernetes`\n\n```\ngit clone https://github.com/jfv-opensource/kube-tools.git\ncd kube-tools\n./km --apply\n```\n\n#####  install runtime container\n\nsource https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html\n\n```\ncurl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \\\n  \u0026\u0026 curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \\\n    sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \\\n    sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list \\\n  \u0026\u0026 sudo apt-get update\n```\n\ninstall nvidia-container-toolkit \n\n```\napt-get install -y nvidia-container-toolkit  \n```\n\nconfigure nvidia runtime in containerd\n\n```\nnvidia-ctk runtime configure --runtime=containerd\nINFO[0000] Loading config from /etc/containerd/config.toml \nINFO[0000] Wrote updated config to /etc/containerd/config.toml \nINFO[0000] It is recommended that containerd daemon be restarted.\n```\n\n```\nsed -i 's/^#root/root/' /etc/nvidia-container-runtime/config.toml\n```\n\nrestart containerd\n\n```\nsystemctl restart containerd\n```\n\n\n\n#### install helm\n\nsource https://docs.nvidia.com/datacenter/cloud-native/gpu-operator/getting-started.html\n\n```\ncurl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 \\\n   \u0026\u0026 chmod 700 get_helm.sh \\\n   \u0026\u0026 ./get_helm.sh\n```\n\nadd the NVIDIA Helm repository:\n\n```\nhelm repo add nvidia https://helm.ngc.nvidia.com/nvidia \\\n   \u0026\u0026 helm repo update\n```\n\n#### install namespaces `gpu-operator` `nvidia/gpu-operator`\n\nsource https://docs.nvidia.com/datacenter/cloud-native/gpu-operator/getting-started.html\n\n```\nhelm install --wait --generate-name \\\n     -n gpu-operator --create-namespace \\\n     nvidia/gpu-operator\n```\n\nWait for pod Ready it can take a while\n\n```\nkubectl get pod -n gpu-operator \nNAME                                                              READY   STATUS      RESTARTS       AGE\ngpu-feature-discovery-nn4mj                                       1/1     Running     0              110m\ngpu-operator-1694693852-node-feature-discovery-master-ccf8plvlt   1/1     Running     1 (104m ago)   110m\ngpu-operator-1694693852-node-feature-discovery-worker-x6rfw       1/1     Running     1 (104m ago)   110m\ngpu-operator-8c6c78df4-pb26s                                      1/1     Running     1 (104m ago)   110m\nnvidia-container-toolkit-daemonset-bqx6p                          1/1     Running     1 (104m ago)   110m\nnvidia-cuda-validator-q259n                                       0/1     Completed   0              104m\nnvidia-dcgm-exporter-fmp4f                                        1/1     Running     0              110m\nnvidia-device-plugin-daemonset-vvzzm                              1/1     Running     0              110m\nnvidia-operator-validator-w4t2l                                   1/1     Running     0              110m\n```\n\n#### run CUDA VectorAdd pod test \n\n```\ncat \u003c\u003c EOF | kubectl create -f -\napiVersion: v1\nkind: Pod\nmetadata:\n  name: cuda-vectoradd\nspec:\n  restartPolicy: OnFailure\n  containers:\n  - name: cuda-vectoradd\n    image: \"nvidia/samples:vectoradd-cuda11.2.1\"\n    resources:\n      limits:\n         nvidia.com/gpu: 1\nEOF\n```\n\nreturn\n\n```\npod/cuda-vectoradd created\n```\n\nread cuda-vectoradd stdout \n\n```\nkubectl logs cuda-vectoradd\n```\n\nYou should get\n\n```\n[Vector addition of 50000 elements]\nCopy input data from the host memory to the CUDA device\nCUDA kernel launch with 196 blocks of 256 threads\nCopy output data from the CUDA device to the host memory\nTest PASSED\nDone\n```\n\n# Run application in containers\n\nClone the repo\n\n```\ngit clone https://github.com/abcdesktopio/gpu.git\n```\n\nCreate the `xgl0` sample pod\n\n```\nkubectl apply -f xgl-0.yml\ndeployment.apps/xgl0 created\n```\n\nGet the pod \n\n```\nkubectl get pods \nNAME                    READY   STATUS    RESTARTS   AGE\nxgl0-7d56d86f5d-kb7jn   1/1     Running   0          7s\n```\n\n\nForward local TCP port 5900 to container TCP port 5900\n\n```\nkubectl port-forward xgl0-7d56d86f5d-kb7jn --address 0.0.0.0 5900:5900 \u0026\nForwarding from 0.0.0.0:5900 -\u003e 5900\n```\n\nStart xterm application inside the `xgl0` pod\n\n```\nkubectl exec -it xgl0-7d56d86f5d-kb7jn -- bash\nuser@xgl0:~$ nohup gnome-terminal \u0026\n[1] 467\nuser@xgl0:~$ nohup: ignoring input and appending output to 'nohup.out'\nuser@xgl0:~$ \n```\n\nOn the node with the nvidia gpu, run nvidia-smi command, to check that the processes `/usr/lib/xorg/Xorg` `/usr/bin/kwin_x11` `/usr/bin/plasmashell` are running. \n\n```\n# nvidia-smi \nMon Apr  3 09:59:09 2023       \n+---------------------------------------------------------------------------------------+\n| NVIDIA-SMI 530.30.02              Driver Version: 530.30.02    CUDA Version: 12.1     |\n|-----------------------------------------+----------------------+----------------------+\n| GPU  Name                  Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |\n| Fan  Temp  Perf            Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |\n|                                         |                      |               MIG M. |\n|=========================================+======================+======================|\n|   0  NVIDIA GeForce GTX 1070         On | 00000000:0B:00.0 Off |                  N/A |\n|  0%   36C    P8                9W / 180W|     38MiB /  8192MiB |     17%      Default |\n|                                         |                      |                  N/A |\n+-----------------------------------------+----------------------+----------------------+\n                                                                                         \n+---------------------------------------------------------------------------------------+\n| Processes:                                                                            |\n|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |\n|        ID   ID                                                             Usage      |\n|=======================================================================================|\n|    0   N/A  N/A    951316      G   /usr/lib/xorg/Xorg                           28MiB |\n|    0   N/A  N/A    951454      G   /usr/bin/kwin_x11                             3MiB |\n|    0   N/A  N/A    951520      G   /usr/bin/plasmashell                          3MiB |\n+---------------------------------------------------------------------------------------+\n```\n\n\n\n\n\n##### On the user desktop\n\nUsing VNC client, connect to the host running the `kubectl port-forward`.\n\nThe default passwd is `mypasswd` for VNC and for the user.\n\nVNC Login \n\n![vnc-login-xgl-0](vnc-login-xgl-0.png)\n\nUser Login \n\n![user-login-xgl-0](user-login-xgl-0.png)\n\n\n\n\n\n\n#### Repeat the same process for `xgl1` and `xgl2` \n\n\n```\n# nvidia-smi \nSun Apr  2 17:21:47 2023       \n+---------------------------------------------------------------------------------------+\n| NVIDIA-SMI 530.30.02              Driver Version: 530.30.02    CUDA Version: 12.1     |\n|-----------------------------------------+----------------------+----------------------+\n| GPU  Name                  Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |\n| Fan  Temp  Perf            Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |\n|                                         |                      |               MIG M. |\n|=========================================+======================+======================|\n|   0  NVIDIA GeForce GTX 1070         On | 00000000:0B:00.0 Off |                  N/A |\n| 20%   50C    P0               55W / 180W|    182MiB /  8192MiB |     85%      Default |\n|                                         |                      |                  N/A |\n+-----------------------------------------+----------------------+----------------------+\n                                                                                         \n+---------------------------------------------------------------------------------------+\n| Processes:                                                                            |\n|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |\n|        ID   ID                                                             Usage      |\n|=======================================================================================|\n|    0   N/A  N/A    561374      G   /usr/lib/xorg/Xorg                           40MiB |\n|    0   N/A  N/A    561524      G   /usr/bin/kwin_x11                             2MiB |\n|    0   N/A  N/A    561575      G   /usr/bin/plasmashell                          3MiB |\n|    0   N/A  N/A    562401      G   /usr/lib/xorg/Xorg                           42MiB |\n|    0   N/A  N/A    562608      G   /usr/lib/xorg/Xorg                           38MiB |\n|    0   N/A  N/A    562619      G   /usr/bin/kwin_x11                             3MiB |\n|    0   N/A  N/A    562636      G   /usr/bin/plasmashell                          3MiB |\n|    0   N/A  N/A    562895      G   /usr/bin/kwin_x11                             3MiB |\n|    0   N/A  N/A    562954      G   /usr/bin/plasmashell                          3MiB |\n|    0   N/A  N/A    565723      G   /usr/lib/firefox/firefox                     26MiB |\n|    0   N/A  N/A    569880      G   glxgears                                      3MiB |\n|    0   N/A  N/A    574570      G   glxgears                                      3MiB |\n|    0   N/A  N/A    574753      G   nvidia-settings                               0MiB |\n|    0   N/A  N/A    575036      G   nvidia-settings                               0MiB |\n|    0   N/A  N/A    576318      G   glxgears                                      3MiB |\n+---------------------------------------------------------------------------------------+\n```\n\nScreenshot running 3 vncviewer and the nvidia-smi command result  \n\n![vnc-nvidia-pods](vnc-nvidia-pods.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabcdesktopio%2Fgpu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabcdesktopio%2Fgpu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabcdesktopio%2Fgpu/lists"}