Running simulations in parallel with LTSpice - Page 1
Forum section: electronics / projects

author: Palmitoxico
author_rank: Regular Contributor
timestamp: May 17, 2020, 03:33:39 pm
content: Hi!I've been using LTSpice to optimize a switching voltage regulator design and I need to obtain performance caracteristics like ripple voltage, efficiency, etc, for different loads. I've been using the.step paramcommand to sweep between diferent loads. The simulation takes arround 15 minutes to complete and uses up to 4 CPU cores. I have a 8 core 16 thread machine and I'm wondering if LTSpice has a command or option to run the simulations in parallel since these are completely independent from each order. I could open different LTSpice instances but it is a little cumbersome to do so.Any tips?

author: SiliconWizard
author_rank: Super Contributor
timestamp: May 17, 2020, 03:54:21 pm
content: Not that I know of.LTSpice will run step'ed simulations in sequence.

author: langwadt
author_rank: Super Contributor
timestamp: May 17, 2020, 04:11:44 pm
content: Quote from: Palmitoxico on May 17, 2020, 03:33:39 pmrun a multiple instance of LTspice with copies of the design each with parts of the different sims ?

author: SiliconWizard
author_rank: Super Contributor
timestamp: May 17, 2020, 04:17:59 pm
content: Quote from: langwadt on May 17, 2020, 04:11:44 pmI think the OP mentioned that and said it was cumbersome, which it definitely is.To make this a little less cumbersome, you could launch LTSpice in batch mode through the command line:http://ltwiki.org/LTspiceHelpXVII/LTspiceHelp/html/Command_Line_Switches.htmand put that in some script/batch file.Note that to make all sims run in parallel, on something like Linux, you'd add a "&" at the end of the command line. I don't remember how to do this on Windows in a batch file (otherwise, it will just run consecutive commands in sequence, which is not what you want.)

author: Palmitoxico
author_rank: Regular Contributor
timestamp: May 17, 2020, 05:47:49 pm
content: Quote from: SiliconWizard on May 17, 2020, 03:54:21 pmQuote from: langwadt on May 17, 2020, 04:11:44 pmI mentined it in my original post. I was hopping that maybe someone known a better solution.Quote from: SiliconWizard on May 17, 2020, 04:17:59 pmI'm running LTSpice though wine. I'll try using it in batch mode as you mentioned + some bash magic. It is not ideal (I will need to create one schematic variant for each instance), but at least I get my simulation results quicker.Thanks!

author: SiliconWizard
author_rank: Super Contributor
timestamp: May 17, 2020, 05:52:38 pm
content: Quote from: Palmitoxico on May 17, 2020, 05:47:49 pmWith some scripting, you could generate a new schematic variant for each stepped value from the original schematic file (.asc files are just text files and relatively easy to figure out) automatically.

author: Ian.M
author_rank: Super Contributor
timestamp: May 17, 2020, 06:54:39 pm
content: Probably the easiest option avoiding manual schematic editing or programmatic .asc file hackery would be to use the command line -netlist option to convert the schematic into a netlist.Next, script the creation of as many uniquely named 'stub' netlists as you want to run instances, each containing whatever .step or .param directives are required to get distinct results from that instance, followed by an .include directive for the previously converted netlist. As the converted netlist is terminated by a .end directive that .include must be the last thing in the 'stub' netlist.Finally launch in parallel an instance of LTspice for each 'stub' netlist in batch mode. Results of .measure directives will be in the .log files named for each 'stub' netlist. If you need to combine waveform files from the different instances, look at Helmut Sennewald's Ltsputil.exe utility, which you should be able to get from the LTspice user group archives.

author: daqq
author_rank: Super Contributor
timestamp: May 17, 2020, 08:18:52 pm
content: If you are going with bash magic, then I guess the simplest would be to script generate all the steps and then script replace the value of the a specific placeholder string. I don't know of any way to force LTSpice to run in such a mode as you described.Also note that you might run into other bottlenecks, such as disk write and so forth.I did do some performance examinations my self, see:https://www.eevblog.com/forum/chat/ltspice-performance-investigation-more-threadsmore-speed!/

author: ejeffrey
author_rank: Super Contributor
timestamp: May 18, 2020, 12:57:04 am
content: I've done this in python. I wrote a script that takes an ltspice netlist with some undefined parameters, defines them and modifies the simulation command then runs ltspice in batch mode and parses the result file. It's pretty easy to run in parallel but the reason I use it is to do more complicated sweeps and optimizations that are practical with native ltspice.