File size: 1,031 Bytes
5471715
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash

# 检查是否传入了 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