我正在研究在大型計算集羣的兩個不同分區上運行程序的項目。我想使用批處理腳本運行此操作,但是在搜索後,仍然不清楚我是否可以在單個批處理腳本中分配和運行兩個不同分區上的程序。下面是諸如此類的事情,我想對於bash錯誤做多分區作業的批處理腳本?
#!/bin/bash
#SBATCH --partition=<WHAT GOES HERE? I want to perform 100 processes on partition "batch" and 1 process on partition "gpu". I will alternate between the 2 during my jobs execution>
#SBATCH --ntasks=<100 on batch, 1 on gpu>
#SBATCH --mem-per-cpu=2G
#SBATCH --time=4-00:00:00
#SBATCH --exclude=nodeynode[003,016,019,020-023,026-030,004-015,017-018,020,024,031]
#SBATCH --job-name="lorem_ipsum"
filenames=("name1" "name2" "name3")
srun -p gpu python gpu_init.py
wait
for i in {0..100}
do
for name in "${filenames[@]}"
do
srun -p batch pythonexecutable &
done
srun -p gpu python gpu_iter.py
wait
done
道歉,我通常是在Python腳本,但我可以爲我在這裏不是我的bash腳本中切換Python模塊(不同版本)(未示出)。我看到實際上可以在批處理腳本的標題中放入分區列表,但是從我讀的內容中,實際上只是告訴調度程序從列表中分配任何可用分區,而不是分配多個分區。
謝謝!