相關(guān)手冊(cè)與軟件準(zhǔn)備
官方使用手冊(cè)
用戶手冊(cè):https://hpc.sustech.edu.cn/ref/cluster_User_Manual.pdf
培訓(xùn)視頻:https://hpc.sustech.edu.cn/ref/meeting_20230810.mp4
啟明2.0使用手冊(cè):https://hpc.sustech.edu.cn/ref/qiming_User_Manual_v3.0.pdf
Anaconda官方教程:https://hpc.sustech.edu.cn/ref/anaconda-install-by-user.html
安裝前置軟件
- FileZilla傳輸數(shù)據(jù)
filezilla是一款用于與遠(yuǎn)程服務(wù)器傳輸數(shù)據(jù)的軟件。
下載FileZilla,下載教程參考https://blog.csdn.net/SoloVersion/article/details/124579221
FileZilla官方使用說明:https://welcome.filezilla-project.org/welcome?type=client&category=documentation_network&version=3.66.1
FileZilla官方網(wǎng)絡(luò)設(shè)置手冊(cè):https://wiki.filezilla-project.org/Network_Configuration
按照步驟登錄節(jié)點(diǎn),注意:在站點(diǎn)管理器中,傳輸協(xié)議要選擇SFTP?。?!不然會(huì)連接失敗。
- xshell登錄節(jié)點(diǎn)
xshell用于遠(yuǎn)程登陸服務(wù)器以及進(jìn)行命令行操作。
xshell安裝官網(wǎng):https://www.xshell.com/zh/free-for-home-school/
深度學(xué)習(xí)模型單節(jié)點(diǎn)訓(xùn)練
以yolov5最基本模型訓(xùn)練為例
1. 配置Anaconda
Anaconda官方教程:https://hpc.sustech.edu.cn/ref/anaconda-install-by-user.html
因?yàn)閍naconda相關(guān)文件會(huì)存儲(chǔ)在自己的工作文件夾里,所以和環(huán)境相關(guān)的步驟可以直接在登錄節(jié)點(diǎn)執(zhí)行。
下載Anaconda(只需完成一次)
test -d ~/softwares/python/anaconda3 || mkdir -p ~/softwares/python/anaconda3 #創(chuàng)建安裝目錄
wget https://mirrors.sustech.edu.cn/anaconda/archive/Anaconda3-2020.07-Linux-x86_64.sh #下載安裝包
sh Anaconda3-2020.07-Linux-x86_64.sh -b -p ~/softwares/python/anaconda3/2020.07 #自動(dòng)安裝到目錄
在安裝目錄寫入環(huán)境變量文件anaconda.2020.07.source,此文件也可以放在任意計(jì)算時(shí)可以調(diào)用的目錄,在命令行輸入:
cat>~/softwares/python/anaconda3/2020.07/anaconda.2020.07.source<<EOF
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/work/ccse-tangh/softwares/python/anaconda3/2020.07/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "~/softwares/python/anaconda3/2020.07/etc/profile.d/conda.sh" ]; then
. "~/softwares/python/anaconda3/2020.07/etc/profile.d/conda.sh"
else
export PATH="~/softwares/python/anaconda3/2020.07/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
EOF
在用戶目錄寫入.condarc文件,配置國(guó)內(nèi)更新源,以便于加快更新和安裝環(huán)境或者軟件包的速度,在命令行輸入:
cat>~/.condarc<<EOF
channels:
- defaults
show_channel_urls: true
channel_alias: https://mirrors.sustech.edu.cn/anaconda
default_channels:
- https://mirrors.sustech.edu.cn/anaconda/pkgs/main
- https://mirrors.sustech.edu.cn/anaconda/pkgs/free
- https://mirrors.sustech.edu.cn/anaconda/pkgs/r
- https://mirrors.sustech.edu.cn/anaconda/pkgs/pro
custom_channels:
conda-forge: https://mirrors.sustech.edu.cn/anaconda/cloud
msys2: https://mirrors.sustech.edu.cn/anaconda/cloud
bioconda: https://mirrors.sustech.edu.cn/anaconda/cloud
menpo: https://mirrors.sustech.edu.cn/anaconda/cloud
pytorch: https://mirrors.sustech.edu.cn/anaconda/cloud
simpleitk: https://mirrors.sustech.edu.cn/anaconda/cloud
EOF
加載環(huán)境變量,清理索引緩存,更新:
source ~/softwares/python/anaconda3/2020.07/anaconda.2020.07.source
conda clean -i
conda update --prefix ~/softwares/python/anaconda3/2020.07 anaconda -y
為每一個(gè)任務(wù)創(chuàng)建一個(gè)conda環(huán)境
直接在登陸節(jié)點(diǎn)創(chuàng)建并配置好requirement,在pbs文件里activate就可以了。在訓(xùn)練節(jié)點(diǎn)無法聯(lián)網(wǎng),不能下載相關(guān)包或者創(chuàng)建環(huán)境?。?!
先激活bash使用conda:
conda init bash
source ~/.bashrc
然后就是標(biāo)準(zhǔn)conda操作了:
conda create -n yolov5 python=3.8 -y -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda activate yolov5
cd yolov5
pip install -r requirements.txt
再正常使用,比如創(chuàng)建,激活等
配置cuda+torch
這里不知道卡了多久,配置cuda和torch主要有幾個(gè)要點(diǎn),分別是:
- 顯卡與驅(qū)動(dòng)(NIVIADA driver)是否適配。
- cuda版本與顯卡是否適配。
- torch是否為gpu版本
- torch版本與cuda,與python是否適配
- touchvision版本與torch是否適配。
詳細(xì)內(nèi)容見
注意沒conda create一個(gè)環(huán)境都要手動(dòng)裝一下torch和torchvision
pip install torch-2.0.0+cu118-cp311-cp311-linux_x86_64.whl
pip install torchvision-0.15.1+cu118-cp311-cp311-linux_x86_64.whl
2. pbs文件編寫
成功完成訓(xùn)練pbs文件示例:
!/bin/bash
#PBS -N yolov5_train
#PBS -l nodes=1:ppn=1,gpus=1
#PBS -l walltime=1:00:00
#PBS -o yolov5_train.out
#PBS -e yolov5_train.err
#PBS -A your_account
#PBS -V
#PBS -q gpu
export PATH=/usr/local/cuda-11.8/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64:$LD_LIBRARY_PATH
# 查看gpu版本
#nvcc --version
# Display GPU information
# nvidia-smi
conda init bash
source ~/.bashrc
conda activate checkcuda5
export GIT_PYTHON_REFRESH=quiet
# 載入cuda
module load cuda/11.8
cd yolov5
python -c "import torch; print(torch.cuda.is_available())"
python train.py --img 640 --epochs 2 --data data/coco128.yaml --weights yolov5s.pt
# 退出 conda 環(huán)境
conda deactivate
3.作業(yè)提交與監(jiān)控
因?yàn)槲覀兊膒bs文件是在win上編輯好后再傳過去的,在提交之前需要轉(zhuǎn)化為unix格式:
dos2unix train_job14.pbs
qsub -q 2a100-80 train_job14.pbs
隊(duì)列選擇
啟明所有隊(duì)列:
查看當(dāng)前隊(duì)列使用情況文章來源:http://www.zghlxwxcb.cn/news/detail-793051.html
qstat
查看自己的作業(yè)文章來源地址http://www.zghlxwxcb.cn/news/detail-793051.html
bjobs
Multi-GPU Training
到了這里,關(guān)于集群服務(wù)器GPU深度模型訓(xùn)練筆記(PBS作用調(diào)度系統(tǒng))的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!