小编Rah*_*are的帖子

如何在 Docker 容器中安装支持 CUDA 的 PyTorch?

我正在尝试在构建 conda 环境的服务器上构建 Docker 容器。除了启用 CUDA 的 PyTorch(我可以在没有 CUDA 的情况下让 PyTorch 工作,但是没问题)之外的所有其他要求都得到满足。如何确保 PyTorch 正在使用 CUDA?

这是Dockerfile

# Use nvidia/cuda image
FROM nvidia/cuda:10.2-cudnn7-devel-ubuntu18.04

# set bash as current shell
RUN chsh -s /bin/bash

# install anaconda
RUN apt-get update
RUN apt-get install -y wget bzip2 ca-certificates libglib2.0-0 libxext6 libsm6 libxrender1 git mercurial subversion && \
        apt-get clean
RUN wget --quiet https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh -O ~/anaconda.sh && \
        /bin/bash ~/anaconda.sh -b -p /opt/conda && \
        rm ~/anaconda.sh && \
        ln -s /opt/conda/etc/profile.d/conda.sh …
Run Code Online (Sandbox Code Playgroud)

python-3.x docker anaconda pytorch

8
推荐指数
2
解决办法
5177
查看次数

标签 统计

anaconda ×1

docker ×1

python-3.x ×1

pytorch ×1