| # 检查是否传入了 bash_script 参数 | |
| if [ -z "$1" ]; then | |
| echo "Error: No bash script provided." | |
| exit 1 | |
| fi | |
| # 获取传入的 bash_script 参数 | |
| bash_script=$1 | |
| # 检查是否传入了 debug 参数 | |
| debug_mode=false | |
| if [ "$2" == "--debug" ]; then | |
| debug_mode=true | |
| fi | |
| # 设置任务的提交命令 | |
| if [ "$debug_mode" == true ]; then | |
| # 如果是debug模式,使用srun | |
| echo "Submitting in debug mode..." | |
| srun -p vp1 --debug --job-name="${bash_script}" \ | |
| --output="logs/${bash_script}.out" \ | |
| --error="logs/${bash_script}.err" \ | |
| --nodes=1 --ntasks=1 --cpus-per-task=4 --mem=32GB --gres=gpu:6 \ | |
| --wrap="bash scripts/${bash_script}" | |
| else | |
| # 否则使用sbatch | |
| echo "Submitting in normal mode..." | |
| sbatch --job-name="${bash_script}" \ | |
| --output="logs/${bash_script}.out" \ | |
| --error="logs/${bash_script}.err" \ | |
| --partition=CAI \ | |
| --nodes=1 --ntasks=1 --cpus-per-task=4 --mem=32GB --gres=gpu:6 \ | |
| --wrap="bash scripts/${bash_script}" | |
| fi |