UMFpackLU backslash operator involving multiple RHS




I was experimenting with out-of-core linear solvers and found that most of my time was spent in computations of the form

where F=lufact(A), A is a sparse matrix, and x is many column vectors.

It seems a straightforward way to parallelize is over the columns of x. I would think UMFpack should have an option for this, but in Julia the result seems to be single threaded.

I see the following issue on GitHub:

but it’s over a year old.

Is there a workaround to get this to parallelize over the columns of x?

Thank you


Did you try something like Andreas’ example at the end of the issue you mentioned? This minimal version works
for me on Julia 0.6.2:

using Base.Threads

function unsafe_solver!(X,F::Base.SparseArrays.UMFPACK.UmfpackLU,B)
    @threads for j in 1:size(B,2)
        A_ldiv_B!(view(X,:,j), F, view(B,:,j))

(unsafe because of lack of sanity checks.)
I observe about 5x speedup for 8 threads on 8 cores.


Thank you this was exactly what I needed!

I did originally try this but I didn’t include using Base.Threads so it complained about my @threads macro. I am trying this now and on surface it appears to be working. The code takes a while to run, hopefully this helps!

Thank you.