General > General Technical Chat
LTSpice: Low CPU utilization?
IDEngineer:
My son is in his fourth year of a BSEE at CalPoly. They have the students using LTSpice. Since he also uses SolidWorks and a few other CPU-intensive programs, he has a rather unsexy (to the typical student) but powerful laptop as his primary computer - i9 CPU, higher end Nvidia GPU, 32GB memory, only SSD's, etc. He has a 32in monitor, separate keyboard and mouse, etc. so it feels like a regular workstation when at his apartment but he can backpack it to class and labs too.
He called me for advice but I'm no LTSpice expert, so here's the question. When he's running LTSpice, some simulations take a while. No problem there, that's a complexity issue or component parameter choice or whatever. He knows to not run anything else, we've pared down his machine so it doesn't have a bunch of crapware on it, etc. All the usual tweaks one does to optimize a machine. He's sadly stuck with Win11 since the machine is rather new, but otherwise it's pretty lean.
The problem is, LTSpice never exceeds ~30% CPU usage. Other programs happily consume 100% of the CPU if nothing else is running. But LTSpice just sits there at 1/3rd throttle, not taking advantage of all the available horsepower.
I seriously doubt LTSpice is written to use hardware acceleration in the GPU, which would otherwise be an explanation since that would not appear in Task Manager's CPU info. Another thought which occurred to me just now is that perhaps he's memory bottlenecked, with the CPU waiting around for external memory fetches, but I don't know if that would appear in CPU utilization. I'll have him check memory performance.
It seems like he could cut his simulation times by 2/3rds if LTSpice simply used 100% of the CPU.
Failing a memory bottleneck... what would prevent LTSpice from running at full CPU speed? Regardless of the number of threads it does or doesn't create, there's a lot of CPU cycles available that aren't being used. What would cause that?
Benta:
The different flavors of Spice don't use that much CPU. What they do use is a lot of memory. I think that's the limiting factor.
IDEngineer:
So are you suggesting that it maxes out allocatable memory and the CPU is waiting on swaps to/from external RAM? It's sitting at 30% total utilization because the on-die cache isn't large enough to hold the short-term working set?
tom66:
You didn't mention how that CPU usage is measured. I am assuming since it is a modern laptop with an i9, it is something like an i9-13900H, which has 14 cores and 20 threads (asymmetrical power architecture like ARM's big.LITTLE).
These processors are very fast at work that is well-parallelised. Computer scientists call this kind of work "embarrasingly parallel". Examples include video compression and decompression (as each macroblock can often be examined as one individual item), 3D raytracing on the CPU, compiling large packages of software and some types of file compression.
However, for applications that cannot be parallelised so well, they may exhibit little to no performance benefit on these processors. Circuit simulation does seem like something that would be hard to parallelise, because you might well have to wait for all of the results from one simulation iteration before the next is started. In fact in some cases higher parallelism can slow tasks down if the problem does not partition well.
Most of the performance improvements in modern computing have not come in the form of faster single threaded performance. There is no doubt that processors today are faster on single thread benchmarks, but the massive performance increases noticed are primarily in multithreaded workloads.
LTspice is not particularly good, in my experience, at using multiple threads. I just tried a test with the LT3496 example with threads set to maximum. It runs at around 1.1ms/sec, and CPU utilisation is 20%. I have a Ryzen 3800X, which is an older generation Zen architecture processor from AMD, it has 16 threads over 8 cores and runs at 4.1GHz normally. The CPU utilisation chart from Task Manager looks like this, it is clear that it is dominating four cores, but actually really only using two at any one time. To maximise performance the Windows kernel is swapping between cores to get the best benefit from the on-core cache (32KB I+D per core). But otherwise the other 12 threads I paid for are going unused. Shame! I set the max threads to 1, and LTspice is only barely slower: 1.02ms/sec vs 1.1ms/sec. This shows whatever benefits it gets from a multicore processor are minimal, at best.
To get this display you need to switch on the multiple CPU view in Task Manager. By default it only shows one CPU.
This is not a memory limit, this is entirely a CPU limit, but you have hit the single threaded CPU limit of the laptop I expect.
Edit: corrected error, re-read your post.
iMo:
At ltspice@groups.io there is a database with performance benchmarks.
What the people there indicate - no improvement with using more than 4 threads, and the gpu does not help as well..
https://groups.io/g/LTspice/table?id=16697&lv=1&p=5%2C%2C%2C20%2C1%2C0%2C0
https://groups.io/g/LTspice/topic/building_a_fast_ltspice/85590859?p=
The newest version 24 may work a little bit faster, however..
Navigation
[0] Message Index
[#] Next page
Go to full version