skip to Main Content

I am trying to use docker (Docker Desktop for Windows 10 Pro) with the WSL2 Backend (WINDOWS SUBSHELL LINUX (WSL) (Ubuntu 20.04.4 LTS)).

That part seems to be working fine, except I would like to pass my GPU (Nvidia RTX A5000) through to my docker container.

Before I even get that far, I am still trying to set things up. I found a very good tutorial aimed at 18.04, but found all the steps are the same for 20.04, just with some version numbers bumpede.

At the end, I can see that my Cuda versions do not match. You can see that here, in this image.

The real issue is when I try to run the test command as shown on the docker website:

 docker run --rm -it --gpus=all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark

I get this error:

 --> docker run --rm -it --gpus=all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark
docker: Error response from daemon: OCI runtime create failed: container_linux.go:380:
starting container process caused: process_linux.go:545: container init caused: Running
hook #0:: error running hook: exit status 1, stdout: , stderr: nvidia-container-cli:
requirement error: unsatisfied condition: cuda>=11.6, please update your driver to a
newer version, or use an earlier cuda container: unknown.

… and I just don’t know what to do, or how I can fix this.

Can someone explain how to get the GPU to pass through to a docker container successfully.

2

Answers


  1. Chosen as BEST ANSWER

    The comment from @RobertCrovella resolved this:

    please update your driver to a newer version when using WSL, the driver in your WSL setup is not something you install in WSL, it is provided by the driver on the windows side. Your WSL driver is 472.84 and this is too old to work with CUDA 11.6 (it only supports up to CUDA 11.4). So you would need to update your windows side driver to the latest one possible for your GPU, if you want to run a CUDA 11.6 test case. Regarding the "mismatch" of CUDA versions, this provides general background material for interpretation.

    Downloading the most current Nvidia driver:

    Version:             R510 U3 (511.79)  WHQL
    Release Date:        2022.2.14
    Operating System:    Windows 10 64-bit, Windows 11
    Language:            English (US)
    File Size:           640.19 MB
    

    Now I am able to support CUDA 11.6, and the test from the docker documentation now works:

    --> docker run --rm -it --gpus=all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark
    Run "nbody -benchmark [-numbodies=<numBodies>]" to measure performance.
            -fullscreen       (run n-body simulation in fullscreen mode)
            -fp64             (use double precision floating point values for simulation)
            -hostmem          (stores simulation data in host memory)
            -benchmark        (run benchmark to measure performance)
            -numbodies=<N>    (number of bodies (>= 1) to run in simulation)
            -device=<d>       (where d=0,1,2.... for the CUDA device to use)
            -numdevices=<i>   (where i=(number of CUDA devices > 0) to use for simulation)
            -compare          (compares simulation results running once on the default GPU and once on the CPU)
            -cpu              (run n-body simulation on the CPU)
            -tipsy=<file.bin> (load a tipsy model file for simulation)
    
    NOTE: The CUDA Samples are not meant for performance measurements. Results may vary when GPU Boost is enabled.
    
    > Windowed mode
    > Simulation data stored in video memory
    > Single precision floating point simulation
    > 1 Devices used for simulation
    GPU Device 0: "Ampere" with compute capability 8.6
    
    > Compute 8.6 CUDA device: [NVIDIA RTX A5000]
    65536 bodies, total time for 10 iterations: 58.655 ms
    = 732.246 billion interactions per second
    = 14644.916 single-precision GFLOP/s at 20 flops per interaction
    

    Thank you for the quick response!


  2. I had the same issue on Ubuntu when I tried to run the container:

    s.evloev@some-pc:~$ docker run --gpus all --rm nvidia/cuda:11.7.0-base-ubuntu18.04
    docker: Error response from daemon: failed to create shim: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error running hook #0: error running hook: exit status 1, stdout: , stderr: Auto-detected mode as 'legacy'
    nvidia-container-cli: requirement error: unsatisfied condition: cuda>=11.7, please update your driver to a newer version, or use an earlier cuda container: unknown.
    

    In my case it occurred when I tried to launch docker image that have nvidia cuda version which is higher than what was installed on my host.

    When I checked my cuda version that was installed on my host I have found that it is version 11.3.

    s.evloev@some-pc:~$ nvidia-smi
    Thu Jul 21 15:06:33 2022       
    +-----------------------------------------------------------------------------+
    | NVIDIA-SMI 465.19.01    Driver Version: 465.19.01    CUDA Version: 11.3     |
    |-------------------------------+----------------------+----------------------+
    | GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC | 
    |...                                                                          |
    +-----------------------------------------------------------------------------+
    
    

    So when I try to run the same cuda version (11.3) it works well:

    s.evloev@some-pc:~$ docker run -it --gpus all --rm nvidia/cuda:11.3.0-base-ubuntu18.04 nvidia-smi
    Thu Jul 21 12:13:46 2022       
    +-----------------------------------------------------------------------------+
    | NVIDIA-SMI 465.19.01    Driver Version: 465.19.01    CUDA Version: 11.3     |
    |-------------------------------+----------------------+----------------------+
    | GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
    | Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
    |                               |                      |               MIG M. |
    |===============================+======================+======================|
    |   0  NVIDIA GeForce ...  On   | 00000000:65:00.0 Off |                  N/A |
    |  0%   44C    P8     7W / 180W |   1404MiB /  8110MiB |      0%      Default |
    |                               |                      |                  N/A |
    +-------------------------------+----------------------+----------------------+
    
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search