Want to know how to call parallel within a python script

Asked by MikeZhao

Nowadays I am trying to make the calculation faster , and I want to use its parallel function.

We usually use the command ‘ yade -j4 file.py' to call more cores when we do simulations via Yade alone. (file.py is the python script) However, I am now trying to couple Yade and FEM, so I can not use that command to call multiple cores. I wonder if I can add some commands into the file to call more cores?

Question information

Language:
English Edit question
Status:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said :
#1

Hi Yang,

if you run Yade from pure Python like in [1], please try the (untested)
following piece of code and let us know if it helped or not. I personally
am very curious..

import sys
sys.argv.extend(['-j','4']) # should be before "import yadeimport"
import yadeimport # or another file name

cheers
Jan

[1]
https://yade-dem.org/doc/user.html#importing-yade-in-other-python-applications

2015-09-22 18:43 GMT+02:00 MikeZhao <email address hidden>:

> New question #271679 on Yade:
> https://answers.launchpad.net/yade/+question/271679
>
> Nowadays I am trying to make the calculation faster , and I want to use
> its parallel function.
>
> We usually use the command ‘ yade -j4 file.py' to call more cores when we
> do simulations via Yade alone. (file.py is the python script) However, I am
> now trying to couple Yade and FEM, so I can not use that command to call
> multiple cores. I wonder if I can add some commands into the file to call
> more cores?
>
>
>
> --
> You received this question notification because your team yade-users is
> an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Can you help with this problem?

Provide an answer of your own, or ask MikeZhao for more information if necessary.

To post a message you must log in.