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

Coloring benchmark problem #93

Closed
ChrisRackauckas opened this issue Feb 4, 2020 · 7 comments
Closed

Coloring benchmark problem #93

ChrisRackauckas opened this issue Feb 4, 2020 · 7 comments

Comments

@ChrisRackauckas
Copy link
Member

ChrisRackauckas commented Feb 4, 2020

using SparseDiffTools, LinearAlgebra, SparseArrays
N = 256
Mx = Tridiagonal([1.0 for i in 1:N-1],[-2.0 for i in 1:N],[1.0 for i in 1:N-1])
My = copy(Mx)
Iy = SparseMatrixCSC(I,N,N)
Ix = SparseMatrixCSC(I,N,N)
fJ = ones(3,3)
Dz = [1 0 0
      0 0 0
      0 0 0]
jacsparsity = kron(Dz,Iy,sparse(Mx)) + kron(Dz,sparse(My),Ix) + kron(fJ,Iy,Ix)
@time colorvec = matrix_colors(jacsparsity)
@matbesancon
Copy link
Contributor

what are Mx and My here?

@ChrisRackauckas
Copy link
Member Author

Oh, I cut SciML/SciMLBenchmarks.jl#91 a little too aggressively.

Mx = Tridiagonal([1.0 for i in 1:N-1],[-2.0 for i in 1:N],[1.0 for i in 1:N-1])
My = copy(Mx)

@matbesancon
Copy link
Contributor

matbesancon commented Feb 4, 2020

For the record, recorded 600 seconds initially (otherwise I'll forget and have to recompute it)

julia> @time colorvec = matrix_colors(jacsparsity)
683.859562 seconds (1.10 M allocations: 121.140 MiB, 0.01% gc time)

@matbesancon
Copy link
Contributor

It's the whole matrix to graph function which is slow, the rest can wait:

julia> @time matrix2graph(jacsparsity, false)
475.198843 seconds (719.90 k allocations: 100.197 MiB, 0.01% gc time)

@matbesancon
Copy link
Contributor

two potential speedups already: dropzeros should be the inplace version, the non-inplace currently used returns a value that is ignored

@matbesancon
Copy link
Contributor

since the indices are known, @inbounds should be used throughout the function

@matbesancon
Copy link
Contributor

#94 is a first take on that, I think there may be a way to improve this even more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants