Why Singularity? Link to heading

abciを使うときにdockerではなくsingularityを使う必要があったのですが、戸惑う部分が多かったので記録しておきます。 dockerはroot権限が奪取される可能性があるため、共用サーバなどではセキュリティの問題から使用できない場面が多いです。

How to use Link to heading

今回扱うバージョンはsingularitypro/3.5です。

1. .def to .sif Link to heading

imageを作成するためのDefinition fileを作成します (詳細は公式ドキュメント) 。
ubuntuのimageをもとにdefinition fileを作成しました (docker-compose.ymlを書くときのイメージですね) 。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
Bootstrap: docker
From: ubuntu

%files
	requirements.txt

%post
	apt update
	apt upgrade -y 
	apt install -y python3
	apt install -y python3-pip
	pip3 install -r requirements.txt

%environment
	export LC_ALL=ja_JP.utf-8
    export LANG=ja_JP.utf-8

2. build Link to heading

このファイルをfoo.defとして保存し、buildします。

1
singularity build --fakeroot foo.sif foo.def

3. run Link to heading

あとは、実行のためのシェルスクリプトを書いて完成です。

1
2
3
4
5
6
7
8
9
#!/bin/sh
#$ -l rt_G.small=1
#$ -j y
#$ -o fit/output/
#$ -cwd
#$ -l h_rt=12:00:00
source /etc/profile.d/modules.sh
module load singularitypro/3.5
singularity run --nv foo.sif run.sh

Memo Link to heading

一応singularityが使えるようになりました。しかし、正直扱うのが難しいなという印象があります。 詰まったところで、検索しても情報が少ないです。 dockerの–rootlessってどうなんですかね。 GPU対応が弱いなどの噂があるので難しいのでしょうか。