'runing a command multiple times in different nodes in SLURM

I want to run three instances of GROMACS mdrun on three different nodes.

I have three temperatures 200,220 and 240 K and I want to run 200 K simulation on node 1, 220 K simulation on node 2 and 240 K simulation on node 3. I need to do all this in one script as I have job number limit.

How can I do that in slurm?

Currently I have:

#!/bin/bash
#SBATCH --nodes=3
#SBATCH --ntasks=3
#SBATCH --ntasks-per-node=1
#SBATCH --time=01:00:00                  
#SBATCH --job-name=1us  
#SBATCH --error=h.err
#SBATCH --output=h.out
#SBATCH --partition=standard  

as my sbatch parameters and

for i in 1 2 3
do
    T=$(($Ti+($i-1)*20))  
    cd T_$T/1000
    gmx_mpi grompp -f heating.mdp -c init_conf.gro -p topol.top -o quench.tpr -maxwarn 1  
    gmx_mpi mdrun -s quench.tpr -deffnm heatingLDA -v &
    cd ../../

done
wait

this is how I am running mdrun but this is not running as fast I want it to run. Firstly, the mdrun does not start simultaneously but it starts in 200K then after 2-3 min it starts on 220K. Secondly, the speed is much slower as expected.

Could you all tell me how can I achieve that?

Thank you in advance.

Best regards, Ved



Solution 1:[1]

You need to add a line in the slurm script

#SBATCH --nodelist=${NODENAME}  

where ${NODENAME} is the name of any of nodes 1, 2 or 3

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Miaow Ritz -io