Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of Absolute Pivot Tolerance for ngspice #301

Open
circlotron opened this issue Feb 20, 2023 · 0 comments
Open

Addition of Absolute Pivot Tolerance for ngspice #301

circlotron opened this issue Feb 20, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@circlotron
Copy link

Is your feature request related to a problem? Please describe.

ngspice-klu (https://sourceforge.net/projects/ngspice/) was exhibiting a lot of "matrix is singular" warnings during GMIN stepping vs ngspice using Sparse. The run time warnings were also affected by the use of the gcc switch -mfma (fused multiply-accumulate). With -mfma the warnings count for KLU and Sparse is identical. Code generated with -mfma is not portable however, as the Intel and AMD fused multiply-accumulate instructions differ.

I think this IEEE 754 reference may explain the accuracy improvement seen using -mfma: https://docs.nvidia.com/cuda/floating-point/index.html

I noticed that Sparse uses PIVREL (relative pivot tolerance) and PIVTOL (absolute pivot tolerance) but KLU only supports PIVREL. As an experiment I added PIVTOL to KLU (using the traditional SPICE default value of 1e-13). This seems to have fixed the excess "matrix is singular" warnings. I've been using the modified ngspice-klu successfully for a few months.

Describe the solution you'd like
My understanding of KLU is limited. I'm concerned that my change is incomplete or breaks something else. Does this change make sense to you?
klu-pivtol.zip

Additional context
The attached code had already been modified a bit for inclusion into ngspice before my addition of an absolute pivot tolerance.

@DrTimothyAldenDavis DrTimothyAldenDavis added the enhancement New feature or request label Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants