Is there a way to force ngspice to use 4 cores dur...
# analog-design
d
Is there a way to force ngspice to use 4 cores during simulations, currently it uses only one when I invoke it from Xschem?
m
You need to create a .spiceinit file with this in it: set num_threads=4
👍 2
d
Thank you, that worked. It uses all 4 cores but the utilization is ~40% per core for the first three cores and ~90% of the 4th. This is when I set it for 4 threads (so it has improved two times roughly). It is ~40% per core for all 4 cores when I set it to 8 threads (as viewed by htop). Is that expected, why is it not utilizing 100%?
m
Parallelizing code is hard! 🙂 The things that can be parallelized are: 1. BSIM model evalution 2. Solving the linear system between each time steep #1 scales well if you have a lot of devices, but you will then be bottlenecked by #2. #2 depends on how interconnected your circuit is whether it can be divided into parallel problems. I'm not sure if/how well ngpisce does this but Xyce does a really good job.
👍 1
I'm guessing the 40% is from the BSIM and then one core is used for #2
👍 1
There's also overhead to share the results in memory
👍 1
d
yes I have considered using Xyce but after seeing this results https://github.com/mabrains/xyce_sky130/blob/main/testcases/xyce_vs_ngspice/comparison_result_ac.csv (207.693% error or rather deviation from ngspice results) I stuck with ngspice because of better accuracy
m
Do you know if ngspice is accurate?
There was additional info that this used an older version with binning problems, I believe. https://skywater-pdk.slack.com/archives/C01TLV579C5/p1634490888084700?thread_ts=1634490888.084700&cid=C01TLV579C5
e
There are some good recommendation on running ngspice with skywater here http://ngspice.sourceforge.net/applic.html