Code Monkey home page Code Monkey logo

docker-flatcar-amd-driver's Introduction

Flatcar Container Linux AMD Driver

docker build --build-arg FLATCAR_VERSION=5.15.119 --build-arg AMD_DRIVER_VERSION=latest .

https://wiki.archlinux.org/title/AMDGPU http://repo.radeon.com https://amdgpu-install.readthedocs.io/en/latest/install-prereq.html#downloading-the-installer-package


OLD

Flatcar Container Linux Nvidia Driver

Leveraging NVIDIA GPUs on Container Linux involves the following steps:

  • compiling the NVIDIA kernel modules;
  • loading the kernel modules on demand;
  • creating NVIDIA device files; and
  • loading NVIDIA libraries

Compounding this complexity further is the fact that these steps have to be executed whenever the Container Linux system updates since the modules may no longer be compatible with the new kernel.

Forklift takes care of automating all of these steps and ensures that kernel modules are up-to-date for the host's kernel.

Installation for Systemd

Requirements

First, make sure you have the Forklift code available on your Flatcar Container Linux machine and that the forklift service is installed.

Getting Started

Enable and start the forklift template unit file with the desired driver:

sudo systemctl enable forklift@nvidia
sudo systemctl start forklift@nvidia

This service takes care of automatically compiling, installing, backing up, and loading the NVIDIA kernel modules as well as creating the NVIDIA device files.

Compiling the NVIDIA kernel modules can take between 10-15 minutes depending on your Internet speed, CPU, and RAM. To check the progress of the compilation, run:

journalctl -fu forklift@nvidia

Verify

Once Forklift has successfully run, the host should have NVIDIA device files and kernel modules loaded. To verify that the kernel modules were loaded, run:

lsmod | grep nvidia

This should return something like:

nvidia_uvm            626688  2
nvidia              12267520  35 nvidia_uvm
...

Verify that the devices were created with:

ls /dev/nvidia*

This should produce output like:

/dev/nvidia-uvm  /dev/nvidia0  /dev/nvidiactl

Finally, try running the NVIDIA system monitoring interface (SMI) command, nvidia-smi, to check the status of the connected GPU:

/opt/drivers/nvidia/bin/nvidia-smi

If your GPU is connected, this command will return information about the model, temperature, memory usage, GPU utilization etc.

Leveraging NVIDIA GPUs in Containers

Now that the kernel modules are loaded, devices are present, and libraries have been created, the connected GPU can be utilized in containerized applications.

In order to give the container access to the GPU, the device files must be explicitly loaded in the namespace, and the NVIDIA libraries and binaries must be mounted in the container. Consider the following command, which runs the nvidia-smi command inside of a Docker container:

docker run -it \
--device=/dev/nvidiactl \
--device=/dev/nvidia-uvm \
--device=/dev/nvidia0 \
--volume=/opt/drivers/nvidia:/usr/local/nvidia:ro \
--entrypoint=nvidia-smi \
nvidia/cuda:9.1-devel

References

docker-flatcar-amd-driver's People

Contributors

analogj avatar mervynzhang avatar strass avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.