wsl2(ubuntu16)中安装cuda11+docker脚本
作者:互联网
cd \
&& echo "修改源" \
&& sed -i "s/archive.ubuntu/mirrors.aliyun/g;s/security.ubuntu/mirrors.aliyun/g" /etc/apt/sources.list \
&& apt-get update \
&& echo "安装cuda-11" \
&& wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin \
&& mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600 \
&& wget https://developer.download.nvidia.com/compute/cuda/11.1.0/local_installers/cuda-repo-wsl-ubuntu-11-1-local_11.1.0-1_amd64.deb \
&& dpkg -i cuda-repo-wsl-ubuntu-11-1-local_11.1.0-1_amd64.deb \
&& apt-key add /var/cuda-repo-wsl-ubuntu-11-1-local/7fa2af80.pub \
&& apt-get update \
&& apt-get -y install cuda \
&& echo "安装docker" \
&& curl https://get.docker.com | sh \
&& echo "安装nvidia-docker2" \
&& distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
&& curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | apt-key add - \
&& curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | tee /etc/apt/sources.list.d/nvidia-docker.list \
&& apt-get update \
&& apt-get install -y nvidia-docker2 \
&& service docker stop \
&& service docker start \
&& echo "测试" \
&& docker run --rm --gpus all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark
标签:ubuntu,apt,cuda11,cuda,&&,nvidia,ubuntu16,docker,wsl2 来源: https://blog.csdn.net/fleaxin/article/details/110310874