1. 程式人生 > >製作Singularity映象 深度學習+tensorflow-gpu+pytorch

製作Singularity映象 深度學習+tensorflow-gpu+pytorch

首先寫一個Singularity清單檔案

mkdir test
cd test
vim dl.def

Singularity recipe內容如下:

Bootstrap: docker
From:nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04

%post
	wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-5.2.0-Linux-x86_64.sh -O ~/anaconda3.sh
	bash ~/anaconda3.sh -b -p /home/anaconda3
	rm ~/anaconda3.sh
	/home/anaconda3/bin/pip install --upgrade pip 
	/home/anaconda3/bin/pip install torch torchvision
	
%environment
	export PATH=/home/anaconda3/bin:$PATH" 

然後執行

sudo singularity build dl.simg dl.def

執行時,由於是gpu環境,需要加上命令–nv,例如:

singularity shell --nv dl.simg