KLU and PSS Analysis Implementations into NGSPICE Francesco Lannutti1,2, Stefano Perticaroli1,2 1 University of Roma ”Sapienza”, DIET 2 NGSPICE Project Dec 12th, 2012 – MOS-AK 2012, San Francisco (CA) – USA NGSPICE People Italian Wing German Wing Francesco Lannutti Dietmar Warning Stefano Perticaroli Holger Vogt Paolo Nenzi Robert Larice KLU and PSS Analysis Implementations into 20/12/2012 Page 2 NGSPICE Overview A short SPICE Challenges introduction to SPICE SPICE Algorithm KLU KLU data structures integration into The Binding Table Idea NGSPICE – New Version Performance Analysis and Conclusion PSS Transient Shooting Algorithm implementation Autonomous Case Implementation into NGSPICE Examples Appendix: Properties of the Circuit Sparse Matrices (Davis) KLU Sparse Direct Linear How KLU works Solver KLU and PSS Analysis Implementations into 20/12/2012 Page 3 NGSPICE SPICE Challenge SPICE3 transient analysis performances Solve time/transient iteration vs Circuit equations all netlists 1.0000E+000 9 • The processing power of CPUs scales as N0.96 f(x) = 2.9256E-007 x^1.2013E+000 00 1.0000E-001 R² = 9.2062E-001 2 ,s • The total solve time of spice scale as N1.2 is 1.0000E-002 e h T • New technologies are described increasing models onds 1.0000E-003 s’ro complexity sec le h 1.0000E-004 c a • As technology improves, SPICE will become B 1.0000E-005 ,V slower in simulating denser circuits a la 1.0000E-006 1 10 100 1000 10000 100000 tile D equations Actual performances over number of circuit equations: 0 1 0 2 Total analysis time 8.75E-7 * N^1.3 ,sis e h Total factor time 4.36E-7 * N^1.4 T D h P Total solve time 2.93E-7 * N^1.2 ,N e r p a K KLU and PSS Analysis Implementations into 20-Dec-12 Page 4 NGSPICE SPICE Algorithm SPICE3 transient analysis algorithm ( ) Initial trial Operating Point = F x,x,t 0 = - h t t Discretize differential equations in time n+1 n+1 n k k å å ( ) = + x ax h bf x ,t Linearize non-linear devices around trial n+1 i n- 1 n+1 i n- i n- i i=0 (i=- 1 ) Define new trial g xm Load linear conductances in circuit matrix ( ) Operating Point xm+1 = xm - a xm r ,0 <a £ 1 ( ) r r r g¢ xm Solve Linear Equations r ( ) ( ) ( ) J xm xm+1 = J xm xm - g xm Convergence ? LTE Calculation We will focus Axm+1 = b where on this part ( ) for KLU A = J xm +G Increment Time ( ) ( ) b= J xm xm - g xm +C End of Time Interval ? KLU and PSS Analysis Implementations into 20-Dec-12 Page 5 NGSPICE KLU INTEGRATION INTO NGSPICE – NEW VERSION KLU and PSS Analysis Implementations into 20/12/2012 Page 6 NGSPICE How spice loads devices into the matrix BSIM4 J for each device_type (i.e. BSIM4) 45nmHP_n for each device_model (i.e N_type) nmos1 for each instance_of_the_model nmos2 Evaluate J(V) and RHS(V) Load J and RHS nmos3 ........ nmosn 45nmHP_p pmos1 pmos2 RHS SPARSE 1.3: • The matrix is stored as a linked list (Setup Phase) pmos3 • The matrix is built iteratively by the instances (Setup Phase) ........ • Each instance knows the memory address of its elements pmosn • This feature gives to device code an O(1) access to the matrix elements • Matrix factorization operations alter the structure of the matrix RES by changing pointer relationships between elements resmod • We want to keep this, but KLU doesn’t, so we need a res1 solution! ……. KLU and PSS Analysis Implementations into 20/12/2012 Page 7 NGSPICE KLU Data Structures KLU uses data structures based on array for both A and LU factorization Ap Ai Ax b q p LU • Sparse Matrix is n-by-n x b )D U • It has «nnz» non-zero elements M L A • The RHS vector is dense LO )D sk C M c • The «p» and «q» vectors contain row o d A l n L b and column permutations sretnioP nmuloC secidni woR stnemele onroeNz- srotceV esneD SHR a FTB ,snarT xaM( rotcev no OC dna FTB( rotcev noita rotcev xedni kcolB lanogaid lla fo noitazir • LveU12c ..toFrLedLfasoUviUc:ar et b,goe rxotyrahi,n zc ataaLhhtltU a idhbot io lnaohss gctotrocsksunr tcestahta ulte thrbe eelfso,a pccfkottowo irnro itze earvnsteie ortwony it tu o at m tc u m re a r p F Thus KLU sacrifices space to ep w U n o L improve time, but this is a good m R u feature, because today space costs lo C 1 z z s less than time! + n n b U n n n n n n N L KLU and PSS Analysis Implementations into 20/12/2012 Page 8 NGSPICE KLU integration into NGSPICE Binding solution idea to respect both SPICE and KLU requirements 1) Netlist Parsing 2) Devices Setup 3) Matrix Allocation as linked list of nodes – no values written yet, only locations 4) Binding Table Creation 5) Linked List to CSC Data Structure Conversion Linked list of nodes CSC data structure KLU and PSS Analysis Implementations into 20/12/2012 Page 9 NGSPICE Binding Table (“Associative Cache”) Example Array Of Structure Sparse original address KLU new address KLU Complex new address 5233563 5982185 5990465 5238545 5985402 5992089 . . . . . . . . . . . . 5236487 5988432 5995679 The New Binding Table is reordered using Quick Sort Algorithm Every element now is searched using Binary Search Algorithm instead of Linear Search Algorithm KLU and PSS Analysis Implementations into 20/12/2012 Page 10 NGSPICE
Description: