Skip to content

Instantly share code, notes, and snippets.

@norbekaiser
Last active December 11, 2020 22:10
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save norbekaiser/0319b3c36182647e65a015629b9e5065 to your computer and use it in GitHub Desktop.
Save norbekaiser/0319b3c36182647e65a015629b9e5065 to your computer and use it in GitHub Desktop.
LXC Nvidia Passthroguh
./deviceQuery Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
Detected 1 CUDA Capable device(s)
Device 0: "GeForce GTX 1080"
CUDA Driver Version / Runtime Version 9.0 / 9.0
CUDA Capability Major/Minor version number: 6.1
Total amount of global memory: 8114 MBytes (8507752448 bytes)
(20) Multiprocessors, (128) CUDA Cores/MP: 2560 CUDA Cores
GPU Max Clock rate: 1898 MHz (1.90 GHz)
Memory Clock rate: 5005 Mhz
Memory Bus Width: 256-bit
L2 Cache Size: 2097152 bytes
Maximum Texture Dimension Size (x,y,z) 1D=(131072), 2D=(131072, 65536), 3D=(16384, 16384, 16384)
Maximum Layered 1D Texture Size, (num) layers 1D=(32768), 2048 layers
Maximum Layered 2D Texture Size, (num) layers 2D=(32768, 32768), 2048 layers
Total amount of constant memory: 65536 bytes
Total amount of shared memory per block: 49152 bytes
Total number of registers available per block: 65536
Warp size: 32
Maximum number of threads per multiprocessor: 2048
Maximum number of threads per block: 1024
Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
Max dimension size of a grid size (x,y,z): (2147483647, 65535, 65535)
Maximum memory pitch: 2147483647 bytes
Texture alignment: 512 bytes
Concurrent copy and kernel execution: Yes with 2 copy engine(s)
Run time limit on kernels: Yes
Integrated GPU sharing Host Memory: No
Support host page-locked memory mapping: Yes
Alignment requirement for Surfaces: Yes
Device has ECC support: Disabled
Device supports Unified Addressing (UVA): Yes
Supports Cooperative Kernel Launch: Yes
Supports MultiDevice Co-op Kernel Launch: Yes
Device PCI Domain ID / Bus ID / location ID: 0 / 1 / 0
Compute Mode:
< Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >
deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 9.0, CUDA Runtime Version = 9.0, NumDevs = 1
Result = PASS
#!/bin/bash
#Downloading Cuda
wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda_9.0.176_384.81_linux-run
#Downloading Nvidia Driver
http://www.nvidia.de/Download/index.aspx?lang=de
ls -al /dev/nvidia*
crw-rw-rw- 1 root root 195, 0 Okt 28 10:29 /dev/nvidia0
crw-rw-rw- 1 root root 195, 255 Okt 28 10:29 /dev/nvidiactl
crw-rw-rw- 1 root root 195, 254 Okt 28 10:29 /dev/nvidia-modeset
crw-rw-rw- 1 root root 242, 0 Okt 28 10:29 /dev/nvidia-uvm
crw-rw-rw- 1 root root 242, 1 Okt 28 10:30 /dev/nvidia-uvm-tools
this results in a passthrough of
lxc.cgroup.devices.allow = c 195:* rwm
lxc.cgroup.devices.allow = c 242:* rwm
➜ root@localhost ~ ls -al /dev/nvidia*
crw-rw-rw- 1 root root 195, 0 Okt 28 10:29 /dev/nvidia0
crw-rw-rw- 1 root root 195, 255 Okt 28 10:29 /dev/nvidiactl
crw-rw-rw- 1 root root 195, 254 Okt 28 10:29 /dev/nvidia-modeset
crw-rw-rw- 1 root root 242, 0 Okt 28 10:29 /dev/nvidia-uvm
crw-rw-rw- 1 root root 242, 1 Okt 28 10:30 /dev/nvidia-uvm-tools
lxc.cgroup.devices.allow = c 195:* rwm
lxc.cgroup.devices.allow = c 242:* rwm
lxc.cgroup.devices.allow = c 254:* rwm
lxc.mount.entry = /dev/nvidia0 dev/nvidia0 none bind,optional,create=file
lxc.mount.entry = /dev/nvidiactl dev/nvidiactl none bind,optional,create=file
lxc.mount.entry = /dev/nvidia-uvm dev/nvidia-uvm none bind,optional,create=file
lxc.mount.entry = /dev/nvidia-uvm-tools dev/nvidia-uvm-tools none bind,optional
Origin: https://developer.nvidia.com/cuda-downloads
cuda_9.0.176_384.81_linux.run
Origin:
NVIDIA-Linux-x86_64-384.90.run
cudnn-9.0-linux-x64-v7.tgz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment