Author Topic: Running simulations in parallel with LTSpice  (Read 3105 times)

0 Members and 1 Guest are viewing this topic.

Offline PalmitoxicoTopic starter

  • Regular Contributor
  • *
  • Posts: 55
  • Country: br
  • no
Running simulations in parallel with LTSpice
« on: May 17, 2020, 03:33:39 pm »
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 param command 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?
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15800
  • Country: fr
Re: Running simulations in parallel with LTSpice
« Reply #1 on: May 17, 2020, 03:54:21 pm »
Not that I know of.
LTSpice will run step'ed simulations in sequence.
 

Offline langwadt

  • Super Contributor
  • ***
  • Posts: 4857
  • Country: dk
Re: Running simulations in parallel with LTSpice
« Reply #2 on: May 17, 2020, 04:11:44 pm »
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 param command 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?

run a multiple instance of LTspice with copies of the design each with parts of the different sims ?


 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15800
  • Country: fr
Re: Running simulations in parallel with LTSpice
« Reply #3 on: May 17, 2020, 04:17:59 pm »
run a multiple instance of LTspice with copies of the design each with parts of the different sims ?

I 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.htm

and 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.)
 

Offline PalmitoxicoTopic starter

  • Regular Contributor
  • *
  • Posts: 55
  • Country: br
  • no
Re: Running simulations in parallel with LTSpice
« Reply #4 on: May 17, 2020, 05:47:49 pm »
Not that I know of.
LTSpice will run step'ed simulations in sequence.

:(

run a multiple instance of LTspice with copies of the design each with parts of the different sims ?

I mentined it in my original post. I was hopping that maybe someone known a better solution.

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.htm

and 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.)

I'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!
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15800
  • Country: fr
Re: Running simulations in parallel with LTSpice
« Reply #5 on: May 17, 2020, 05:52:38 pm »
I'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.

With 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.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13217
Re: Running simulations in parallel with LTSpice
« Reply #6 on: May 17, 2020, 06:54:39 pm »
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.
 

Offline daqq

  • Super Contributor
  • ***
  • Posts: 2321
  • Country: sk
    • My site
Re: Running simulations in parallel with LTSpice
« Reply #7 on: May 17, 2020, 08:18:52 pm »
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!/
Believe it or not, pointy haired people do exist!
+++Divide By Cucumber Error. Please Reinstall Universe And Reboot +++
 

Online ejeffrey

  • Super Contributor
  • ***
  • Posts: 4034
  • Country: us
Re: Running simulations in parallel with LTSpice
« Reply #8 on: May 18, 2020, 12:57:04 am »
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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf