Confusion with setting ntasks and ntasks per node for MD

Dear all,

I have to submit a gromacs MD job to an HPC with SLURM. I use the following line to run the job:

mpirun -np 48 mdrun -deffnm md

However, my confusion lies in setting the number of tasks, nodes and cores. SLURM offers a few commands viz., ntasks,ntasks-per-node, cores-per-task. My question is: Is one mdrun command one task ?
For instance if I have to run a simple MD and I have to use 100 cores for it, should I use ntasks =1 and cores-per-task=100 or ntasks=2,ntasks-per-node=1,cores-per-task=50 and so on?

Please help me clear this confusion.

Thank you.

Hi,

ntasks refers to the number of MPI ranks to be started, and yes, each task will be an mdrun process. cores-per-task sets the number of OpenMP threads for each of the mdrun processes. If you run on a single node, ntasks and ntasks-per-node will be the same. If your node has 48 cores, then you want the product of MPI ranks times OpenMP threads to equal 48 for optimal GROMACS performance, so 48 ranks x 1 Thread or 24x2, or 12x4, or 8x6, … would all work. If you run without GPUs, a small number of OpenMP threads per MPI rank will usually result in best performance (say, 1, 2, 4, or 6).

Best,
Carsten

1 Like

Thank you so much @Carsten. That clears up things.