Ask Your Question

Python Parallel Dynamics Simulations

asked 2015-04-15 16:44:27 -0500

Jacde gravatar image

I am trying to get PSSE to run multiple simulations to compare the results to one another. As there will be many simulations, I want to "parallelize" the simulations. I have given multiprocessing.Process and multiprocessing.pool a shot and can not get it working.

Here is base code I've been trying to get to work. It solves and creates an out file in the folder if I have the pool function only iterate once. If I try to change it to multiple values, I start getting invalid temporary file or visual fortran errors.

Do I have something incorrect in the coding? Is my understanding of the pool function not correct?

import psspy,redirect,multiprocessing as m

def run_fault(x):
    case, snp, out, log = x
    # Redirect output from PSSE to Python
    # Initialize PSSE
    # Load case
    # Convert generators:
    # Solve for dynamics
    # Initialize and run the case

if __name__ == "__main__":
    folder = r"C:\Program Files (x86)\PTI\PSSE32\EXAMPLE\dyn"

    # Generate processes to run
    size = 2
    arglist = []
    for i in range(size):
    pool = m.Pool()
    P =, iterable=arglist)

Any help would be appreciated.

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2015-04-15 20:39:02 -0500

jconto gravatar image

updated 2021-06-29 12:31:58 -0500

I have written a python code, named MPjobs, that allow running as many instances of PSSe as CPU’s in a pc, in other words, runs PSSe in parallel at the process level. It uses pool.apply_async and a dictionary to pass the arguments. This tool is suitable for repetitive studies where the changing variable is known, like during benchmarking models, sensitivity runs or dynamic fault simulations.

You can download the MPjobs code with a demo set compatible with PSSe v33, v34 and v.35 from [copy the link into your browser if it does not work by clicking on it]:

JContogoogledrive, select "MPjobs PSSe in Parallel" and then select “”. An icon on the top-center screen will perform the download.

As it is, MPjobs can be used to parallelize runs from ‘almost’ any application that can run from a DOS window with an input file or line arguments.

Follow the instruction in the file and in the wiki doc to run the demos included.

edit flag offensive delete link more


I did something similar but I do experience few race conditions with PSSE32. Do you experience any? Another issue is zombie processes in multiprocessing module--how do you manage it?

sheng gravatar imagesheng ( 2015-04-17 05:57:19 -0500 )edit

For PSSe 32, I have install the module 'multiprocessing', a port to allow python 2.5 use multiprocessing calls. The race conditions, two processes accessing the same data, are minimized by introducing a 1 sec delay for each new process call. Zombie processes are a problem. Tracking PID maybe?

jconto gravatar imagejconto ( 2015-04-17 08:48:18 -0500 )edit

Issue is multiprocessing.Pool hang forever if a worker process dies unexpectedly

sheng gravatar imagesheng ( 2015-05-04 21:00:48 -0500 )edit

Your demo code with the link "" is invalid. Has it been deleted?

Linzhi gravatar imageLinzhi ( 2017-07-06 21:18:54 -0500 )edit

I updated the link! Same combination of alpha-numerics but in a link format. It works now.!

jconto gravatar imagejconto ( 2017-07-07 10:29:53 -0500 )edit

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


Asked: 2015-04-15 16:44:27 -0500

Seen: 52,197 times

Last updated: Jun 29