Running parallel yade from the same input file

Asked by Najm

Hi,

I have a input.py file that I need to run 10 times (without any changes in the input.py file). I have a powerful computer that can handel all the 10 simulations at once. Currently, I open 10 terminals and type in "yade -n -x input.py" to each of them and then press enter.

This is painfull. Is there a way I can have all the 10 minulations run (parallel) at once with just one click or one terminal.

Thank you so much for your help.

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Najm
Solved:
Last query:
Last reply:
Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#1

$ mpirun -np 4 echo "haha"
haha
haha
haha
haha

Does it help? :)
B

Revision history for this message
Jérôme Duriez (jduriez) said :
#2

You may also look at https://yade-dem.org/doc/user.html#batch-queuing-and-execution-yade-batch

I did not get how much equal your 10 cases are, but with 10 lines in the .table file described in the above, you will have, on your computer, 10 simulations running in parallel in one terminal command.

Revision history for this message
Jan Stránský (honzik) said :
#3

if using bash, you can do in terminal
for i in {1..10}; do yade -n -x input.py; done
cheers
Jan

Revision history for this message
Robert Caulk (rcaulk) said :
#4

Why not another python script ;)?

import subprocess

for i in range(0,9):
    subprocess.call(['yade','-n','-x','input,py'])

Revision history for this message
Najm (mrhappy) said :
#5

Thank you all for your inputs. I finally did this:

Make a python file (Batch.py) and write in:

import os
for i in range(10):
  os.popen("gnome-terminal -x yade -n -x input.py")

Then in your command line, type in python Batch.py

Again, thank you all for your help!