GROMACS hangs when run from python multiprocess – User discussions

GROMACS version: 2022.4
GROMACS modification: No
Here post your question

Dear all,
I have written a small python program that runs multiple simulations under Linux using multiprocessing to run a set of parallel simulations. The program then analises the data from each produced trajectory.
Each thread runs a single instance of gmx and produces the trajectory as expected.

Unfortunately, when the trajectory is produced, the process doesn’t close and the jobs hang there waiting forever or until I kill them, using GPU memory although they finished.
I know there is the -multidir option but due to how the program is structured I can’t use it (it would mean rewriting a lot of code that is used by other classes and stuff).

So far I have tried:
gmx mdrun -gpu_id {GPU} -deffnm {self.par[“Output”]}{trajCount}{walk_count}
or
mpirun -np 2 gmx_mpi mdrun -multidir {walk_count} -gpu_id {GPU} -deffnm {self.par[“Output”]}{trajCount}{walk_count}
and finally:
mpiexec -np 2 gmx_mpi mdrun -ntomp 8 -gpu_id {GPU} -deffnm {self.par[“Output”]}{trajCount}{walk_count}

They all work and make the trajectory, but they all hang at the end. I suspect it’s how multiprocess and mpi interact (a thread that creates multiple threads?)
What can I do to “trigger” the release of the process after the production of the trajectory is complete?

I have seen that this question was asked in the forums about 18 years ago ([gmx-users] gromacs hanging at end of parallel run) but the answer was not clear or was followed up.

Unfortunately, this issue seems to happen only with GROMACS (tested with NAMD, ACEMD and openMM) as if it’s waiting for a signal to move forward and close the thread.

Thank you for any help or advice!

Ludovico

Read more here: Source link