The previous post on this topic looked at the performance of alternative Scipy sparse equation solvers. This post updates those results with the current Scipy version (1.7.1), with very different results. It also compares the Scipy solver performance with the PyPardiso package, which provides an interface to the Intel MKL Pardiso library to solve large sparse linear systems of equations.
The sparse solver function spsolve has an optional argument called permc_spec that defines “how to permute the columns of the matrix for sparsity preservation”. My timings for the previous post found that the argument NATURAL had very much better performance than any other alternative. This time, NATURAL performed as before, but all the other options had substantially improved, so that it had become the second slowest for the matrix used in the previous post, and the slowest for larger matrices.
The solvers have been compared for solving the stiffness matrix for 3D building frames of increasing size. The table below shows the timing results for the four spsolve options, the banded solver, two iterative solver options, and the PyPardiso solver. Each option has been timed for a system with 14742 equations (as in the previous post), 29487 equations, and 56705 equations.
Two times are reported for the Pardiso function: the time for the first calculation, and a much faster time for subsequent calculations, provided the stiffness matrix is unchanged.
- The MMD_AT_PLUS_A option is now the fastest of the four spsolve options.
- The Pardiso function is substantially faster than any spsolve option on the first run, especially for the larger equation systems, and of the order of 50 times faster again on subsequent runs with the same stiffness matrix.
- The banded solver was slower than Pardiso for the two smaller systems, and failed with a memory error for the third.
- The two iterative solvers were faster than Pardiso, especially for the largest system, but returned solutions with significant differences from the “exact” solver solutions. Also note that if the same stiffness matrix was to be used with multiple load cases then Pardiso would be very much quicker.
In summary the Pardiso package was substantially faster than any spsolve option, especially for very large systems, was also faster than the banded solver, and was able to handle larger systems than the banded solver.
In the next post I will look at procedures for installing the Pardiso package, and calling the function from Excel using pyxll.
Pingback: Installing PyPardiso | Newton Excel Bach, not (just) an Excel Blog
Pingback: Installing PyPardiso and speed of Scipy spsolve | Newton Excel Bach, not (just) an Excel Blog