1
Singularity簡介
怎么樣高效的搭建分析流程且能保證分析流程穩(wěn)定運行的使用效果呢?目前主流的是conda和 容器技術(shù) (container)。
雖然 conda能解決大部分生信軟件安裝問題 ,但是 若軟件安裝多了 ,會出現(xiàn)兼容性問題以及 ”臃腫” 現(xiàn)象,為此,引入容器技術(shù)(container)來解決這些問題。
在容器技術(shù)中,docker和singularity 是常用的容器軟件。但 docker不太適合 HPC 環(huán)境 。因為在調(diào)度管理器上容器無法施加資源限制、多用戶(非 root 用戶)使用時會出現(xiàn)權(quán)限問題、而且docker會存在一些不必要的資源開銷。
為此,引進singularity容器來解決docker的一些 缺點 。首先,singularity可以兼容docker的鏡像,同時構(gòu)建出的鏡像可以很容易進行拷貝和轉(zhuǎn)移,且體積更??;此外singularity 假設(shè)用戶在一個有root權(quán)限的系統(tǒng)上構(gòu)建容器,在一個沒有root權(quán)限的系統(tǒng)上運行容器,兼顧了數(shù)據(jù)的安全性和便捷性,更加符合實際的應(yīng)用場景。
2
Singularity安裝
方法1:conda安裝( 最簡便、無需root權(quán)限 )
conda create -n singularity singularity -y
方法2:自行編譯
#1. 安裝依賴
sudo apt-get update && sudo apt-get install -y \\
build-essential \\
uuid-dev \\
libgpgme-dev \\
squashfs-tools \\
libseccomp-dev \\
wget \\
pkg-config \\
git \\
cryptsetup-bin
#2.安裝 GO 語言;下載地址:https://golang.org/dl/
cd
wget https://dl.google.com/go/go1.20.1.linux-amd64.tar.gz
tar -xzvf go1.20.1.linux-amd64.tar.gz
rm go1.20.1.linux-amd64.tar.gz
添加到環(huán)境變量
echo 'export PATH=~/go/bin:$PATH' >>~/.bashrc
#3. 下載 singularity;下載地址:https://github.com/hpcng/singularity/releasessudo
apt install singularity-container #不一定是最新版
#或
wget https://github.com/apptainer/singularity/releases/download/v3.8.7/singularity-3.8.7.tar.gz
$ tar -xzf singularity-3.8.7.tar.gz
cd singularity
#4. 安裝 singularity
./mconfig
cd builddir
make
sudo make install
#最后記得添加到 PATH哦。
3
Singularity基礎(chǔ)知識
1.Singularity的兩種鏡像格式
2.兩種鏡像格式之間的轉(zhuǎn)換
3.其他常見命令
4
Singularity實操
- 下載 images
Container Library
Docker Hub
#官方庫下載
singularity pull --arch amd64 library://library/default/ubuntu:20.04
#Docker鏡像轉(zhuǎn)Singularity鏡像
singularity pull docker://ubuntu:20.04
- 創(chuàng)建沙箱
singularity build --sandbox blast ubuntu_20.04.sif
- 進入容器
默認會自動掛載 **HOME, **PWD , /tmp , /proc , /sys , /dev 目錄。
容器內(nèi)用戶完全一致,當(dāng)需要root權(quán)限時加–fakeroot參數(shù)進入容器,且root只在容器內(nèi)有效。
#交互式運行
singularity shell ubuntu_20.04.sif bash
#Singularity> echo 'hello world'
#Singularity>id
#直接運行
singularity exec ubuntu_20.04.sif echo 'hello world'
#修改容器
singularity shell --writable --fakeroot blast
#Singularity>id
apt update
cd /opt/
wget https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/LATEST/ncbi-blast-2.13.0+-x64-linux.tar.gz
tar -zxvf ncbi-blast-2.13.0+-x64-linux.tar.gz
- 打包
singularity build blast.sif blast
- 運行程序
#通過 --bind 掛載文件夾
singularity shell --bind /home/test/test.fa:/mnt blast.sif
#直接運行程序
singularity exec blast.sif \\
makeblastdb -dbtype prot -in test.fasta -out test
singularity exec blast.sif \\
blastp -query test.fa -db test -out blast.xml -outfmt 6
5
總結(jié)
總的來說,現(xiàn)在存在著各種各樣的容器技術(shù),比如docker,podman,singularity等。每一個都有自己的優(yōu)缺點和 使用范圍 。比如docker****適合于web網(wǎng)頁開發(fā)等、singularity****適合于在集群上挖掘大數(shù)據(jù)。
-
HPC
+關(guān)注
關(guān)注
0文章
333瀏覽量
24326 -
Docker
+關(guān)注
關(guān)注
0文章
515瀏覽量
12956 -
docker容器
+關(guān)注
關(guān)注
0文章
31瀏覽量
3495
發(fā)布評論請先 登錄
大話芯片制造之讀后感超純水制造
iPad買一送四 美國老太不貪心成幸運兒
LabVIEW大調(diào)查,幸運好禮送不停(已頒獎)
祝賀張飛老師開設(shè)個人板塊
2015 論壇改版意見征集~
從零開始搭建微信硬件開發(fā)環(huán)境全過程——1小時掌握微信硬件開發(fā)流程
【線上活動】2017許愿有禮~
【獲獎名單公布】猜價格、贏獎品、回帖得積分—是德科技1688網(wǎng)店年中大促
做好一款產(chǎn)品項目開發(fā),你還需要學(xué)習(xí)哪些硬件設(shè)計技能?
【中獎公示】第一期有獎蓋樓活動中獎名單公布,請盡快兌獎~
信令流程和業(yè)務(wù)流程

評論