随着宇宙第一编译器 Visual Studio 的弟弟 Visual Studio Code (我也是宇宙第一编辑器!雾)不断的迭代更新,到今天它已经极度适用于远程开发,官方对于 VS Code 远程开发的扩展三剑客:Remote-SSH,Remote-Container,Remote-WSL 给开发者和研究者带来了巨大的便利。
FROM pytorch/pytorch:1.9.0-cuda10.2-cudnn7-devel# By default, GPU support is built if CUDA is found and torch.cuda.is_available() is true. # It’s possible to force building GPU support by setting FORCE_CUDA=1 environment variable, # which is useful when building a docker image.ENVFORCE_CUDA=1
# From Detectron2# This will by default build detectron2 for all common cuda architectures and take a lot more time,# because inside `docker build`, there is no way to tell which architecture will be used.ARGTORCH_CUDA_ARCH_LIST="Kepler;Kepler+Tesla;Maxwell;Maxwell+Tegra;Pascal;Volta;Turing"ENVTORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST}"# From MMAction2. Not necessary.RUN apt-get updateRUN apt-get install git vim libgl1-mesa-glx ffmpeg ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6# Not necessary.RUN pip install gpustat pycocotools scipy opencv-python
(3)实例化镜像(images)生成容器(containers):
此处需要注意,用 docker run 实例化镜像时,需要带上 gpu 相关的命令参数,否则在容器里可能看不到 gpu。如,可以使用下列命令:
docker run --gpus all --shm-size=8g -it -v /home/chenjoya/data/:/data chenjoya/pytorch