Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

无法在docker内部启用vulkan支持gpu。docker可以运行nvidia-smi,但不能运行vulkaninfo或运行vulkaninfo没有显示gpu支持。 #5719

Open
dujifeng opened this issue Oct 1, 2024 · 2 comments

Comments

@dujifeng
Copy link

dujifeng commented Oct 1, 2024

detail | 详细描述 | 詳細な説明

Dockerfile如下:

##设置继承镜像
FROM nvidia/cuda:11.6.1-devel-ubuntu20.04
##下面开始运行更新命令
RUN apt update
##设置为非交互模式
ENV DEBIAN_FRONTEND=noninteractive
##install ncnn dependencies
RUN apt install -y --fix-missing build-essential git cmake libprotobuf-dev protobuf-compiler libomp-dev libvulkan-dev vulkan-tools libopencv-dev
&& apt clean
##add vulkan package
ADD vulkansdk-linux-x86_64-1.2.198.1 /workspace/ncnn/vulkansdk-linux-x86_64-1.2.198.1
ENV VULKAN_SDK=/workspace/ncnn/vulkansdk-linux-x86_64-1.2.198.1/x86_64
ENV PATH=$VULKAN_SDK/bin:$PATH
ENV LD_LIBRARY_PATH=$VULKAN_SDK/lib:$LD_LIBRARY_PATH

docker启动脚本如下:

##!/bin/bash

##宿主机上的库路径
HOST_LIB_PATH="/usr/lib/x86_64-linux-gnu"

##Docker 容器中对应的库路径
CONTAINER_LIB_PATH="/usr/lib/x86_64-linux-gnu"

##构建映射参数
VOLUME_ARGS=""

##查找所有与 Nvidia 相关的库
for file in $(find $HOST_LIB_PATH -name "libnvidia.so*"); do
VOLUME_ARGS="$VOLUME_ARGS -v $file:$CONTAINER_LIB_PATH/$(basename $file)"
done
##echo $VOLUME_ARGS
docker run -itd --gpus all -v /home/dj/workspace/:/workspace -w /workspace --name dj_ncnn_cuda_11.6.1
$VOLUME_ARGS
-v /usr/share/vulkan/icd.d/nvidia_icd.json:/etc/vulkan/icd.d/nvidia_icd.json
-e VK_ICD_FILENAMES=/etc/vulkan/icd.d/nvidia_icd.json
ncnn_cuda:11.6.1 /bin/bash

@wzyforgit
Copy link
Contributor

可能提到docker那边更好?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants