# SymRCM doesn't seem to help linear solver to perform

**URL:** <https://discourse.julialang.org/t/symrcm-doesnt-seem-to-help-linear-solver-to-perform/69878>\
**Category:** Performance\
**Tags:** question\
**Created:** [October 16, 2021, 8:08am UTC](https://discourse.julialang.org/t/symrcm-doesnt-seem-to-help-linear-solver-to-perform/69878 "2021-10-16T08:08:43Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Niceno](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/niceno/32/29648_2.png) [@Niceno](https://discourse.julialang.org/u/Niceno)\
**Post date:** [October 16, 2021, 8:08am UTC](https://discourse.julialang.org/t/symrcm-doesnt-seem-to-help-linear-solver-to-perform/69878/1 "2021-10-16T08:08:43Z")

</div>

Dear all,

Yesterday I came across SymRCM.jl package, which seems to work really neatly and is easy to use, but it doesn’t seem to bring me any performance benefits. Allow me to explain. I wrote a little computational fluid dynamics program in Julia, and this is how the system matrix looks after discretization:

```julia
julia> A
26419×26419 SparseArrays.SparseMatrixCSC{Float64, Int64} with 176659 stored entries:
⣿⣿⢮⣷⣴⣵⣰⣷⣖⣎⣮⡨⣶⣰⣁⣭⣗⣖⡾⣁⣄⡐⡀⣤⣶⣀⣀⣄⢄⣈⡀⡂⡐⠂⢀⠐⣁⡀⢀⣦⢐⣁⠀⠀⠀⡄⣰⣌⢰⣠⣹⣿⣷⣧⡀
⢮⣷⣿⢟⣿⣿⣿⣷⣿⣿⣿⣿⢿⣿⣿⣿⣿⣻⣿⣟⣿⣿⣿⣿⣻⣷⣿⣻⣿⡿⡿⣛⢍⣷⣯⣿⣮⢿⠿⢿⣷⢫⡳⢏⣻⣿⡷⣣⣽⣿⣿⣿⣿⣿⡇
⢔⣿⣿⣿⣿⣿⣿⣿⣿⡿⠭⣿⣷⢿⣽⣽⢽⡿⢻⣎⣿⡻⣟⣽⣷⡿⣯⡟⢿⣷⡯⡯⣻⣯⠿⢟⡏⣠⡿⢵⡑⣼⡻⣽⣗⣮⣥⣳⣸⣾⡿⢷⣽⣟⠇
⢴⣾⢿⣿⣿⣿⣿⣿⣟⣻⢷⣿⡟⣿⡾⣝⢍⣿⣟⣙⣺⢿⣟⢯⠹⣵⣴⣟⢯⠍⡚⢻⠼⢶⣗⣏⣻⣺⡳⢴⢧⣏⣐⡥⢿⢃⢿⡯⣹⡷⡻⣶⣺⢻⠇
⡸⢽⣿⣿⣿⡿⣿⣹⢿⣷⣻⣿⡍⡞⣰⠳⣫⡳⣟⣔⠥⡽⠭⣏⣿⡚⢖⣿⣯⠪⡪⣮⣵⢽⡭⢟⠹⣟⠷⠂⡦⣲⠇⢾⣣⣳⢆⡂⠼⢭⣵⡘⣿⣿⡂
⡊⡻⣿⣿⣧⣧⣽⣷⣿⣾⣿⣿⡶⢼⣭⣧⡠⠹⠴⣇⣵⡭⢯⢞⣥⣟⠶⡗⣬⡳⣦⠫⣴⠵⠜⠏⢣⣚⢰⣄⢿⢣⢦⡵⣱⡜⠹⢳⢌⡙⡟⢟⢻⣏⠁
⢘⣻⣿⣷⣽⣟⣿⣭⣣⠭⣘⣏⣿⣿⡛⣬⠵⠼⠓⡏⣺⠜⡌⠳⠥⢻⡒⢹⠺⣴⢹⣾⢡⠶⢯⠠⢔⢿⢲⠣⠟⡨⢶⡽⡢⣠⠇⢬⡛⢳⢜⣵⣎⣸⡅
⡅⣼⣿⣿⣗⣿⣞⢯⢴⡚⠧⣿⡛⣬⢿⣷⡽⠓⢫⣙⣵⢸⠎⢵⠘⢽⠏⠺⢳⣢⡞⠣⣳⠶⣂⣞⡵⡢⣼⣃⣈⠉⠔⢒⠱⢆⡮⢊⡗⢾⢇⡫⢫⣽⡆
⢹⢽⣿⣻⣷⡷⣧⣵⢯⡺⣄⡊⣑⡇⢷⠋⡿⣯⡕⠞⡵⣴⠢⠉⢁⡑⢔⢒⣊⡿⣮⡠⠻⢴⢚⢹⡠⡅⢁⡆⢘⣇⢒⣮⣆⢛⢼⡐⣫⡋⣽⡏⠭⢿⡇
⠞⢫⣿⢿⡻⢶⣟⢹⢛⢽⠴⢧⡽⠤⣏⢲⣱⠍⣿⣿⡈⡧⠖⢑⡎⠠⢉⢷⡝⠀⢒⣘⡟⣓⣚⢦⢓⢋⡂⣭⠾⠒⢕⢀⠚⢌⣑⠱⠒⣬⣝⡽⡷⢽⡆
⢀⠹⣿⣿⣿⡻⣾⣞⣅⡧⡕⡿⣚⠞⣑⣛⢑⣯⠦⡬⢿⣷⣒⠌⢛⢓⠰⠀⠓⡺⢙⠅⢐⠘⡉⠖⣋⠙⠔⡇⡛⡂⠳⣆⢒⡾⠪⢌⠧⡹⠧⣎⢹⣕⠀
⠀⣬⣿⣿⣟⣽⡿⣝⡧⢧⣫⢗⢦⡉⢎⣅⡌⠂⢜⢁⡘⠜⢿⣷⡢⠽⢬⡙⠁⢝⡑⢠⣍⢎⠉⠇⡜⣐⢑⢖⡙⢩⣐⢕⢠⠭⡉⠄⠦⣶⣆⡇⠡⠤⠄
⠘⢻⢿⣾⣽⡿⢗⣦⣻⠻⣥⢿⣥⣃⣖⣄⢅⠰⠊⡉⢿⢐⣌⡎⢿⣷⡖⢸⠧⡠⠐⢲⡅⢌⠠⠉⠠⠾⠈⢴⢲⠁⡈⡠⠰⢠⣎⠇⠘⠻⠆⣒⠺⣿⠃
⠀⢼⣿⣻⣯⠿⣴⢿⣼⣵⢼⠧⣜⣈⣫⡁⢰⢑⢧⣔⠐⠂⣆⠳⣘⣉⠻⣦⡘⣁⡀⠈⠸⡱⠸⣡⠓⡕⠘⠙⠗⣴⣀⡒⢚⡮⠶⢦⠁⠶⡥⢇⡊⡀⠀
⡀⢱⣿⡿⢿⣷⡏⠗⡫⡛⢦⡻⢚⣦⠹⣲⣮⡼⠓⠉⣹⡠⣅⢄⠉⡣⠖⢨⣻⣾⡕⡋⠨⡎⠈⣐⡘⣾⠰⢓⠠⠊⡉⡨⠃⡡⢮⠁⠚⢓⠃⣀⣨⣨⡅
⠠⠨⣿⢫⡯⡯⣾⣈⡪⣮⡬⡛⣳⣶⠾⡉⠊⡻⣘⢰⠗⠔⠑⣈⢰⣀⡀⠈⡵⠩⣿⣿⣀⠙⢈⢡⠁⠛⠀⠠⠆⡄⡠⠠⣬⡆⡁⢡⢀⠓⠦⡬⠄⢵⠆
⠰⠈⢧⣵⡿⣾⢲⣇⣕⣟⢔⡟⢡⡖⢹⡞⢛⣆⢿⢩⣐⠐⡣⢝⡁⢍⢖⡢⡢⠦⣄⠘⡻⣮⣢⠦⠉⠰⠱⡴⡂⢡⣄⡘⠓⠃⠐⣒⡶⠨⡗⡖⠪⠉⠁
⢀⠐⣯⣿⣿⢇⡽⢽⣧⢏⡶⠅⠋⡓⣨⢼⣞⣐⠺⣜⢣⠌⠧⠄⡄⠂⠖⣢⢂⢠⠆⣐⠨⡞⡻⣮⡨⠝⡇⠅⡪⡈⠾⠒⣠⣙⠐⠃⣌⡇⠈⢺⠇⠀⡁
⠁⠸⣮⣟⠋⣩⣻⣺⣷⢦⣩⢲⣴⣕⠱⡫⠄⠮⡽⢐⣏⠘⢒⢩⣠⡆⢝⠤⣲⣬⣥⠀⢃⡀⣆⠎⠻⣦⡧⠐⡣⠤⡀⣆⠏⢄⡀⢈⡈⡗⠘⢊⡩⢝⠂
⠠⣴⣿⣇⢟⣏⢙⣎⠹⠃⠐⢶⠼⡒⠶⢻⠡⠴⡌⣬⠴⠥⢱⢔⢂⣄⣖⠀⢴⢂⠀⡀⢑⡦⠍⠍⢉⠋⣻⣾⡲⠰⠃⠐⠈⠡⠂⣲⡤⢅⠈⢯⡵⠄⠀
⠔⢰⡽⣛⣑⣬⡭⢷⢨⣫⠿⣓⡛⡡⡆⠘⠶⢴⢺⠃⠻⠨⡗⣈⠜⠒⢙⣥⡠⠂⠈⠥⠌⣈⡊⠪⠉⡎⢘⡊⢻⣶⡊⠊⣀⢀⠐⠒⠁⠀⣼⡓⠦⠶⠂
⠀⠀⡽⢎⣟⣮⠔⡼⣩⣅⢌⡷⣜⡷⢰⢁⡸⣴⠑⢑⠹⢦⢔⢜⠂⡨⢠⠸⡃⡨⠀⡊⣀⠹⢺⠃⠠⢬⢉⠀⡪⠈⡿⣯⡉⠀⢉⣉⡇⠂⠒⠅⢡⠤⠀
⠀⠤⣿⣾⡹⣽⠿⢓⢭⣺⣑⠾⠈⣪⠱⢆⣬⢙⡚⢄⣸⡴⡄⡖⠐⣂⡺⡴⠍⡠⠢⠿⠽⠀⣄⢺⠋⢅⠆⡀⠀⢘⠃⠈⠻⣦⣀⠊⠂⠤⡂⡀⠩⢵⡂
⡐⢾⠽⣫⢥⣻⡿⡷⠨⠱⢷⣂⡉⣅⡪⢋⢒⠳⢕⡘⡊⢆⠃⠌⠮⠝⠸⣇⠎⠓⠅⣈⢰⢠⠴⠀⡀⢈⢨⣠⢰⠀⡇⢰⡠⠘⠻⣦⡶⠦⢰⢂⡁⡚⠃
⠐⣲⣷⣿⣲⣾⢷⡾⡖⣇⣆⠱⢿⣈⣹⣍⡯⠺⡘⣤⣍⡣⢨⣧⣶⡀⢡⡄⢾⢀⢤⠐⡘⡋⠦⠽⢦⠬⠄⢏⠁⠀⠩⠉⠈⡄⠸⡏⠟⢅⣐⣒⣒⣂⠀
⣷⣾⣿⣿⢿⣏⢻⣮⣑⠻⣿⢍⢖⣵⡭⡱⡷⠿⣗⡽⡩⢧⠬⠽⢨⢡⠥⢏⠉⢠⡈⡧⢹⠭⣢⣀⡲⢀⡦⣄⢶⠻⠜⠄⠈⠨⠰⢒⢰⢸⠑⢄⠇⡆⠀
⠽⣿⣿⣿⣷⢿⣾⣚⣿⣿⡿⢶⣊⣹⣏⣶⣧⣇⣝⣏⢗⢶⠁⡆⣾⣦⠊⠨⡂⣺⢄⣅⡎⠂⠉⠁⣇⢎⠑⠏⢨⡇⠁⡖⢇⣆⣡⠨⠸⢸⠩⠥⠑⢄⠀
⠀⠈⠉⠉⠉⠁⠉⠁⠈⠈⠁⠀⠁⠉⠈⠉⠉⠉⠈⠉⠀⠀⠀⠁⠉⠀⠀⠀⠁⠉⠈⠁⠁⠀⠁⠈⠈⠀⠀⠀⠈⠀⠀⠀⠈⠈⠉⠀⠀⠀⠀⠀⠀⠀⠁

```

I made no attempt to renumber the unknowns, and the structure is … well … ugly. But here comes SymRCM, which I use in the following way:

```julia
julia> p=symrcm(A);
julia> B=A[p,p]
26419×26419 SparseArrays.SparseMatrixCSC{Float64, Int64} with 176659 stored entries:
⠻⣦⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠙⢿⣷⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠹⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠈⠻⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠈⠻⣿⣿⣶⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠘⢿⡿⣯⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣷⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣿⣿⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⣿⣿⣿⡿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⣯⢿⣷⡿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⣯⣿⣿⣝⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠳⣽⢿⣷⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⣿⣿⣿⣿⢦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⣟⣿⣿⣿⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⢿⣿⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠻⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⣿⣿⣦⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⢿⣷⣄⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣷⣄⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣷⡀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⣦⡀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠁
julila> b=a[p];

```

The banded matrix looks really neat, SymRCM did a good job. However, if I run a few numerical test for the solution of both linear systems, this is what I get:

```julia
julia> @time A\a;
  0.214344 seconds (76 allocations: 87.890 MiB, 1.04% gc time)

julia> @time A\a;
  0.212042 seconds (76 allocations: 87.890 MiB, 1.05% gc time)

julia> @time B\b;
  0.222544 seconds (76 allocations: 85.415 MiB, 1.02% gc time)

julia> @time B\b;
  0.226223 seconds (76 allocations: 85.415 MiB, 1.00% gc time)

```

I tried with a bigger system too (499000x499000 matrix) and observed similar thing:

```julia
julia> @time A\a;
 10.209412 seconds (74 allocations: 2.419 GiB, 0.29% gc time)

julia> @time A\a;
 10.375933 seconds (78 allocations: 2.419 GiB, 0.87% gc time)

julia> @time A\a;
 10.203141 seconds (74 allocations: 2.419 GiB, 0.03% gc time)

julia> @time B\b;
 11.448977 seconds (78 allocations: 2.585 GiB, 0.75% gc time)

julia> @time B\b;
 11.374048 seconds (74 allocations: 2.585 GiB, 0.02% gc time)

julia> @time B\b;
 11.415554 seconds (76 allocations: 2.585 GiB, 0.24% gc time)

```

It seems that the banded system didn’t offer any advantage in terms of CPU time, it even seems fractionally slower. Do you guys have an idea what is going on here? Is it maybe so that linear solver being invoked with `A\a` also calls algorithms to reduce the matrix bandwidth?

P.S. The matrices are stored in `SparseMatrixCSC` format and I use `LinearAlgebra` and `SparseArrays` in addition to the `SymRCM` mentioned above. Quite frankly, I don’t know which solver is invoked with `\` operator. I would assume one from Krylov space family. In such a case, band width might not play such a big role, but I would still assume fewer cache misses during the solution and better performance.

Cheers

---

<div class="post-metadata">

**Author:** ![Paulo\_Jabardo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paulo_jabardo/32/3196_2.png) [@Paulo\_Jabardo](https://discourse.julialang.org/u/Paulo_Jabardo)\
**Post date:** [October 16, 2021, 6:25pm UTC](https://discourse.julialang.org/t/symrcm-doesnt-seem-to-help-linear-solver-to-perform/69878/2 "2021-10-16T18:25:21Z")

</div>

I don’t know what the sparse matrix package does internally but you could try the BandedMatrices package [https://github.com/JuliaMatrices/BandedMatrices.jl](https://github.com/JuliaMatrices/BandedMatrices.jl).

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [October 17, 2021, 12:26am UTC](https://discourse.julialang.org/t/symrcm-doesnt-seem-to-help-linear-solver-to-perform/69878/3 "2021-10-17T00:26:56Z")

</div>

What if you try one of the direct solvers? `cholesky` or `ldlt`?

---

<div class="post-metadata">

**Author:** ![RoyiAvital](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/royiavital/32/571_2.png) [@RoyiAvital](https://discourse.julialang.org/u/RoyiAvital)\
**Post date:** [October 17, 2021, 3:20am UTC](https://discourse.julialang.org/t/symrcm-doesnt-seem-to-help-linear-solver-to-perform/69878/4 "2021-10-17T03:20:24Z")

</div>

I think it would be great if documentation includes example for using `ldlt` and `cholesky` as example.

---

<div class="post-metadata">

**Author:** ![Niceno](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/niceno/32/29648_2.png) [@Niceno](https://discourse.julialang.org/u/Niceno)\
**Post date:** [October 18, 2021, 8:50am UTC](https://discourse.julialang.org/t/symrcm-doesnt-seem-to-help-linear-solver-to-perform/69878/5 "2021-10-18T08:50:45Z")

</div>

Thanks for the answer Petr. It is quite conceivable that the difference for direct solvers would be significant since the bands are much narrower after the call to symrcm and simply less memory is allocated and addressed. But this is not a route I would like to take, I would stay with iterative solvers since they have much smaller memory footprint and my long-term goal is to use many unknowns over a number of GPUs.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [October 18, 2021, 3:24pm UTC](https://discourse.julialang.org/t/symrcm-doesnt-seem-to-help-linear-solver-to-perform/69878/6 "2021-10-18T15:24:06Z")

</div>

OK, but then there is little merit in renumbering. Iterative solvers don’t care.

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [October 18, 2021, 3:38pm UTC](https://discourse.julialang.org/t/symrcm-doesnt-seem-to-help-linear-solver-to-perform/69878/7 "2021-10-18T15:38:27Z")

</div>

In that case, you probably want to turn your matrix into a `BandedMatrix`

---

<div class="post-metadata">

**Author:** ![Niceno](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/niceno/32/29648_2.png) [@Niceno](https://discourse.julialang.org/u/Niceno)\
**Post date:** [October 18, 2021, 3:55pm UTC](https://discourse.julialang.org/t/symrcm-doesnt-seem-to-help-linear-solver-to-perform/69878/8 "2021-10-18T15:55:29Z")

</div>

Thanks, but I would just increase the storage. I must stick with sparse solvers.

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [October 18, 2021, 4:07pm UTC](https://discourse.julialang.org/t/symrcm-doesnt-seem-to-help-linear-solver-to-perform/69878/9 "2021-10-18T16:07:09Z")

</div>

BandedMatrix is a sparse format. It will likely take less space than a generic sparse structure.

---

<div class="post-metadata">

**Author:** ![Niceno](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/niceno/32/29648_2.png) [@Niceno](https://discourse.julialang.org/u/Niceno)\
**Post date:** [October 19, 2021, 6:45am UTC](https://discourse.julialang.org/t/symrcm-doesnt-seem-to-help-linear-solver-to-perform/69878/10 "2021-10-19T06:45:45Z")

</div>

I was expecting that renumbering unknowns will lead to fewer cache misses even in iterative solvers. But it seems I was wrong.

---

<div class="post-metadata">

**Author:** ![Niceno](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/niceno/32/29648_2.png) [@Niceno](https://discourse.julialang.org/u/Niceno)\
**Post date:** [October 22, 2021, 4:22am UTC](https://discourse.julialang.org/t/symrcm-doesnt-seem-to-help-linear-solver-to-perform/69878/11 "2021-10-22T04:22:23Z")

</div>

Hi guys,

I have some additional details. Renumbering with `SymRCM` doesn’t help the default solver from `SparseArrays.jl` (which is umfpack, to my understanding), but it does help a lot if I use a combination of a solver from `IterativeSolvers.jl` with LU preconditioner from `IncompleteLU.jl`. Depending on the linear system size, renembering reduces the time spend in the linear solver anywhere from 30% to 60% for the systems I’ve been testing - which range from 20\_000 to 2\_000\_000 unknowns.

```
Cheers

```

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [October 22, 2021, 9:15am UTC](https://discourse.julialang.org/t/symrcm-doesnt-seem-to-help-linear-solver-to-perform/69878/12 "2021-10-22T09:15:53Z")

</div>

Note that this is consistent with our reasoning above: LU factorization needs to consider all matrix entries that could become non-zero. The reordering reduces the total number of such operations because the entries are tightly clustered around the diagonal.

---

<div class="post-metadata">

**Author:** ![Niceno](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/niceno/32/29648_2.png) [@Niceno](https://discourse.julialang.org/u/Niceno)\
**Post date:** [October 22, 2021, 9:37am UTC](https://discourse.julialang.org/t/symrcm-doesnt-seem-to-help-linear-solver-to-perform/69878/13 "2021-10-22T09:37:21Z")

</div>

Yes, I agree, pretty consistent.
