How to compute 16 different simulations on parallel with pbs script on the same machine
An answer to this question on the Scientific Computing Stack Exchange.
Question
I have a 32 cores machine, and I need to run 16 different dynamics simulations in parallel on it. I want the 16 jobs to run in parallel, not sequentially, on the same machine. The 16 dynamics input are in different folders and they requires the same time to complete.
pbs script:
#!/bin/bash -l
#PBS -l nodes=...:ppn=32,walltime=...
#
#PBS -N dynamics
export OMP_NUM_THREADS=32
export PATH=mypath:$PATH
export DIR="my folder"
export WORK=/scratch/Work/
cp -r $DIR/dyn1 $WORK/.
cp -r $DIR/dyn2 $WORK/.
...
cp -r $DIR/dyn3 $WORK/.
cd $WORK
my_dynamic_program1.x
my_dynamic_program2.x
Answer
There are a few options, but these two come to mind as the most straight-forward:
You could submit 16 different jobs to your scheduler.
You could modify your script to start your programs in the background:
my_dynamic_program1.x &
my_dynamic_program2.x &
(the & says: start running this command and immediately run the next one as well)
You could even do:
cd dir1
./prog1.exe &
cd dir2
./prog2.exe &
...