代码之家  ›  专栏  ›  技术社区  ›  pherris

Nvidia Docker-在构建容器时是否可以使用Cuda_运行时?

  •  0
  • pherris  · 技术社区  · 6 年前

    在试图用Docker容器的build命令编译darknet时,我经常遇到异常 include/darknet.h:11:30: fatal error: cuda_runtime.h: No such file or directory .

    我正在根据以下说明建造集装箱: https://github.com/NVIDIA/nvidia-docker/wiki/Deploy-on-Amazon-EC2 . 我有一个简单的 Dockerfile 我正在测试-相关部分:

    FROM nvidia/cuda:9.2-runtime-ubuntu16.04
    ...
    WORKDIR /
    RUN apt-get install -y git
    RUN git clone https://github.com/pjreddie/darknet.git
    WORKDIR /darknet
    # Set OpenCV makefile flag
    RUN sed -i '/OPENCV=0/c\OPENCV=1' Makefile
    RUN sed -i '/GPU=0/c\GPU=1' Makefile
    #RUN ln -s /usr/local/cuda-9.2 /usr/local/cuda
    # HERE I have been playing with commands to show me the state of the docker image to try to troubleshoot the problem
    RUN find / -name "cuda_runtime.h"
    RUN ls /usr/local/cuda/lib64/
    RUN less /usr/local/cuda/README
    RUN make
    

    我看到的大多数文档都是在运行容器时使用NVIDIA库引用的,但是在使用 gpu 支持,所以我需要 cuda_runtime.h 在生成时可用。

    也许我误解了什么 nvidia-docker 正在做-我假设 尼维迪亚码头工人 存在是因为NVIDIA代码必须安装在实际主机上,而不是安装在容器内,因此它们使用某种机制与容器共享“本机”代码,以便管理GPU-是否正确?

    我应该试着去建造吗 darknet 在构建容器时,还是应该将其安装在主机上,然后以某种方式提供给容器?这似乎与容器的可移植性背道而驰,但我可以忍受一些限制来访问GPU。

    1 回复  |  直到 6 年前
        1
  •  2
  •   ArtemB    6 年前

    来自Nvidia/CUDA:9.2-Runtime-Ubuntu16.04

    你的图像只有CUDA-9.2的一些片段需要 运行 一个CUDA应用程序,但不具备 建造 一个。

    您需要使用-devel变量。

    推荐文章