How to achieve parallel execution for syz simulation in Siwave UI using IronPython w/o interruptions

Post Description
I'm facing a challenge with executing parallel syz simulations in the siwave UI using an IronPython script. I'm seeking advice on how to manage or eliminate interruptions during the process
Script Functionality
My IronPython script automates several key tasks necessary for setting up syz simulations:
- Creation of ports and resistors
- Activation of required capacitors
- Configuration of the syz simulation parameters
To execute simulations in parallel, the script utilizes threading module. It schedules and queues multiple sys simulation runs simultaneously, according to the user-defined number of parallel executions.
Issues Encountered
During the execution of each thread, a "Server Busy" dialog box sporadically interrupts the process. The message displayed is:
- This action cannot be completed because the other program is busy. choose 'Switch To' to activate the busy program and correct the problem.
This prompt halts my script and requires manual intervention, as the user must click "Retry" to dismiss the dialog and allow the script to continue.
Additional Observations:
Interestingly, when I manually copy and paste my IronPython code into the IronPython command shell within the siwave ui, this issue does not occur, and the simulations proceed without any interruptions:
Help
Has anyone experienced similar issues with parallel execution in siwave or found a workaround to bypass the "Server Busy" dialog? Any insights on configuring the environment or scripting techniques to prevent this interruption would be greatly appreciated.
Answers
-
Hey @jcjustinchoo I'm not sure how much this will help with your issue but I noticed a common conflation in your question that could be the source of the problem you're encountering. Essentially,
multi-threading != parallelisation
Using the
threading
module can split operations up into threads, but when you run your Python code it will not run those threads in parallel to each other. Only one thread will run at a time. If a thread is delayed or waiting for something it will switch to another thread in the mean time but you never actually get true parallelisation. This would explain why your whole script is being paused when one thread hits an error.See here, for more info: https://www.reddit.com/r/learnpython/comments/qk0cx2/what_is_the_difference_between_multithreading/
or here
for true parallelisation in Python you really need to use the
multiprocessing
module. Although i don't believe it is available in IronPython unfortunately.0 -
Hi @James Derrick, really grateful for your response and appreciate your guidance.
Initially, I did attempt to use the multiprocessing module for true parallelism, but realized that it was available in IronPython. Forturnately, I was able to solve my issue by taking advantage of the fact the IronPython is integrated with the .NET framework. With System.Threading.Tasks.Parallel class, I was able to execute multiple syz simulations within a single SIwave UI without interruptions.
However, I've encountered a challenge with this approach: simultaneous thread execution prevents the program from writing logs to the session file (.log), so without monitoring the entire process, I cannot tell whether the correct capacitor was activated for a particular simulation run. I'm currently utilizing the oDoc.ScrLogMessage function for logging, but it seems insufficient for concurrent access. If you have any suggestions or insights on how to achieve thread-safe logging or alternative approaches, I'd greatly appreciate your input.
0