Ask Your Question
1

Use multiple Processor for PSSE Dynamics Run

asked 2019-08-26 13:06:01 -0500

ddhungana gravatar image

Is there an easy way via python scripting to use multiple cores on a single computer for PSSE Dynamics Run. It is taking too long to complete dynamics runs, and I suspect the default system is only using a single core. Any help will be appreciated.

edit retag flag offensive close merge delete

Comments

Thank you all for your responses. This is adequate information for me to get started.

ddhungana gravatar imageddhungana ( 2019-08-29 10:05:48 -0500 )edit

3 answers

Sort by ยป oldest newest most voted
1

answered 2019-08-29 08:11:46 -0500

bronco7TX gravatar image

updated 2019-08-29 08:14:28 -0500

Python also has the ability to split work across multiple cores. Some sample code below on how we run multiple dynamic simulations on the same machine in parallel. Be careful on how many workers you add. The problem can become I/O with all the data from the multiple runs and running 4 in parallel will not be 400% faster than running 1. You get a diminishing rate of return the more cores you add. With this code, you can easily play around with how many cores you want to use and find the optimal number for your machine.

Sample code:

import multiprocessing
from multiprocessing import Process
from multiprocessing import Pool

workers = multiprocessing.cpu_count() - 1 # Run on N-1 cores on local machine
p = Pool(workers)
p.map(run_test, tests) # run_test is a function you call in parallel, tests is an array of data that gets passed to the function (could be case name, snapshot, fault name, etc...)

def run_test(test):
    # Run you stability run here...
edit flag offensive delete link more
0

answered 2019-08-26 13:34:54 -0500

jconto gravatar image

Check the post "Python Parallel Dynamics Simulations", with a link to my python tool MPjobs.

edit flag offensive delete link more

Comments

Hi jconto, I'm trying to do a 2D run with two cases and 1 contingency. Would you know why instead of running the simulations in parallel, it waits for the first one to finish, and then runs the second simulation. Your help would be appreciated!

Type1_bus gravatar imageType1_bus ( 2020-09-22 00:22:03 -0500 )edit

Usually the OS control what task goes to what CPU. In PSSe dynamic runs of small networks, the communication needs imposed by the OS usually are bigger or comparable with the actual running time. Parallel time gains are expected for large system or longer run times. BTW, your scenario seems a 1D.

jconto gravatar imagejconto ( 2020-09-22 10:56:29 -0500 )edit

Thanks jconto! I was assuming the 1D.ini file will not let me run it if there are 2 cases (1D only allows 1 case and multiple contingencies?). Am I wrong?

Type1_bus gravatar imageType1_bus ( 2020-09-25 12:38:01 -0500 )edit

1D studies allows 1 independent variable (Xvar) in a study, like multiple contingencies, but everything else the same or multiple cases with same contingency. For multiple cases, multiple contingencies, use the 2D.ini example, where 2D studies allows for 2 independent variables (Xvar, Yvar).

jconto gravatar imagejconto ( 2020-09-25 13:10:46 -0500 )edit

Thanks jconto! I'm now using multiple cases and contingencies using mp2D.ini. I'm running dynamic simulations for large networks and still noticing that the runs are happening one by one as opposed to running in parallel. Do you think I'm missing something? Your help is much appreciated!

Type1_bus gravatar imageType1_bus ( 2020-09-26 07:47:07 -0500 )edit

It seems your runs are in "mptype=MPP" mode, the default parallel mode, an entry in the INI file. The second option is "mptype=MPAA". In MPAA, a run is given to available CPU until all jobs are done. In MPP, jobs groups are formed before each group is given to a CPU, runs are 1x1 within a group.

jconto gravatar imagejconto ( 2020-09-26 14:09:31 -0500 )edit

Thanks jconto! This solved the problem of running multiple instances simultaneously. Appreciate your help on this. I'm now running into issues where after a few runs (2-3 simulations later) it gets stuck somewhere during initialization and only works if I restart mpjobs again. Did you run into this?

Type1_bus gravatar imageType1_bus ( 2020-09-29 09:40:16 -0500 )edit

Try increasing the delay between runs to avoid 'collision'. In INI file: poolDelay = 20 / time delay to start next run. default for poolDelay is 0. For real network of 7000 buses, I use between 10 to 20 sec for pooldelay.

jconto gravatar imagejconto ( 2020-09-29 10:05:52 -0500 )edit

Thanks jconto! This seemed to fix the issues.

Type1_bus gravatar imageType1_bus ( 2020-09-29 12:48:45 -0500 )edit
0

answered 2019-08-26 13:28:36 -0500

acd1 gravatar image

You may know this already, but Siemens sells a "Parallel Dynamics Module," which I'm sure will fit your needs. There is a 1-month free trial available by the looks of it. I'm sure it's quite expensive after that.

I couldn't tell you if there's a good way of parallelizing a dynamics run with Python.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

1 follower

Stats

Asked: 2019-08-26 13:06:01 -0500

Seen: 1,210 times

Last updated: Aug 29 '19