-
Notifications
You must be signed in to change notification settings - Fork 65
Description
(The original issue was posted at JuliaLang/LinearAlgebra.jl#970, but I was recommended to re-post it here.)
The two sparse matrices A and B are constructed by the finite difference method for partial differential equations. A corresponds to a nearly diagonal matrix representing material parameters; B corresponds to a curl operator in a 2D Cartesian space. Here is how they look like:
julia> A
160000×160000 SparseMatrixCSC{ComplexF64, Int64} with 160000 stored entries:
⠑⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠑⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠑⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠑⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠑⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⢄⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⢄⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⢄⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⢄⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⢄
julia> B
160000×80000 SparseMatrixCSC{ComplexF64, Int64} with 320000 stored entries:
⢳⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⢳⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⢳⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⢳⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⢳⡀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⢳⡀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠈⢷⡀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢷⡀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠈⢷⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧⠀
⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧Now, Here is the timing of first execution of A \ B in Julia 1.8. It takes 557 seconds:
julia> VERSION
v"1.8.3-pre.2"
julia> @timev A \ B
557.904421 seconds (7.08 M allocations: 364.345 MiB, 0.62% compilation time)
elapsed time (ns): 557904420654
gc time (ns): 0
bytes allocated: 382043682
pool allocs: 7070597
non-pool GC allocs: 4410
malloc() calls: 15
realloc() calls: 2
free() calls: 0
minor collections: 0
full collections: 0
160000×80000 SparseMatrixCSC{ComplexF64, Int64} with 320000 stored entries:
⢳⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⢳⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⢳⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⢳⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⢳⡀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⢳⡀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠈⢷⡀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢷⡀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠈⢷⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧⠀
⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧Second execution is not much different:
julia> @timev A \ B
557.779810 seconds (33 allocations: 19.246 MiB)
elapsed time (ns): 557779810182
gc time (ns): 0
bytes allocated: 20180968
pool allocs: 12
non-pool GC allocs: 13
malloc() calls: 6
realloc() calls: 2
free() calls: 0
minor collections: 0
full collections: 0
160000×80000 SparseMatrixCSC{ComplexF64, Int64} with 320000 stored entries:
⢳⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⢳⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⢳⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⢳⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⢳⡀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⢳⡀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠈⢷⡀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢷⡀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠈⢷⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧⠀
⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧On the other hand, here is the timing of A \ B for the two matrices constructed by the same code, but on Julia 1.7. First execution takes 3.2 seconds:
julia> VERSION
v"1.7.2-pre.0"
julia> @timev A \ B
3.199857 seconds (6.39 M allocations: 349.351 MiB, 2.93% gc time, 99.37% compilation time)
elapsed time (ns): 3199857054
gc time (ns): 93635079
bytes allocated: 366321440
pool allocs: 6385404
non-pool GC allocs:4326
malloc() calls: 7
realloc() calls: 2
GC pauses: 2
160000×80000 SparseMatrixCSC{ComplexF64, Int64} with 320000 stored entries:
⢳⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⢳⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⢳⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⢳⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⢳⡀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⢳⡀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠈⢷⡀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢷⡀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠈⢷⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧⠀
⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧Second execution is even faster with 0.023 secs:
julia> @timev A \ B
0.023254 seconds (33 allocations: 19.246 MiB)
elapsed time (ns): 23254352
bytes allocated: 20180968
pool allocs: 12
non-pool GC allocs:13
malloc() calls: 6
realloc() calls: 2
160000×80000 SparseMatrixCSC{ComplexF64, Int64} with 320000 stored entries:
⢳⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⢳⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⢳⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⢳⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⢳⡀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⢳⡀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠈⢷⡀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢷⡀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠈⢷⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧⠀
⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧Is this a known issue? Otherwise, please advise what I should do to further identify the cause of the regression. The two matrices A and B are constructed by my big packages, so it is a bit difficult to generate a MWE demonstrating the regression without further guidance.
Here is the versioninfo() output for Julia 1.8.
julia> versioninfo()
Julia Version 1.8.3-pre.2
Commit 97ccb970c0 (2022-10-28 06:19 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin21.6.0)
CPU: 8 × Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-13.0.1 (ORCJIT, skylake)
Threads: 1 on 4 virtual cores
Environment:
JULIA_PKG_DEVDIR = /Users/wsshin/Programming
JULIA_EDITOR = code
JULIA_NUM_THREADS =