dllehr81 / libnvidia-container

NVIDIA container runtime library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

libnvidia-container

GitHub license GitHub release Package repository Travis Coverity Scan

Warning: This project is an alpha release, it is not intended to be used in production systems.

This repository provides a library and a simple CLI utility to automatically configure GNU/Linux containers leveraging NVIDIA hardware.
The implementation relies on kernel primitives and is designed to be agnostic of the container runtime.

Installing the library

From packages

Refer to the repository configuration for your Linux distribution.

From sources

make install

# Alternatively in order to customize the installation paths
DESTDIR=/path/to/root make install prefix=/usr

Using the library

Container runtime example

Refer to the nvidia-container-runtime project.

Command line example

# Setup a rootfs based on Ubuntu 16.04 inside new namespaces
cd $(mktemp -d) && mkdir rootfs
sudo unshare --mount --pid --fork
curl http://cdimage.ubuntu.com/ubuntu-base/releases/16.04/release/ubuntu-base-16.04-core-amd64.tar.gz | tar -C rootfs -xz
useradd -R $(realpath rootfs) -U -u 1000 -s /bin/bash nvidia
mount --bind rootfs rootfs
mount --make-private rootfs
cd rootfs

# Mount standard filesystems
mount -t proc none proc
mount -t sysfs none sys
mount -t tmpfs none tmp
mount -t tmpfs none run

# Isolate the first GPU device along with basic utilities
nvidia-container-cli --load-kmods configure --no-cgroups --utility --device 0 .

# Change into the new rootfs
pivot_root . mnt
umount -l mnt
exec chroot --userspec 1000:1000 . env -i bash

# Run nvidia-smi from within the container
nvidia-smi -L

Copyright and License

This project is released under the BSD 3-clause license.

Issues and Contributing

A signed copy of the Contributor License Agreement needs to be provided to digits@nvidia.com before any change can be accepted.

About

NVIDIA container runtime library

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:C 90.8%Language:Makefile 7.3%Language:Logos 1.3%Language:Shell 0.7%