# UMFpackLU backslash operator involving multiple RHS

**URL:** <https://discourse.julialang.org/t/umfpacklu-backslash-operator-involving-multiple-rhs/11194>\
**Category:** General Usage\
**Tags:** question, performance\
**Created:** [May 28, 2018, 1:42am UTC](https://discourse.julialang.org/t/umfpacklu-backslash-operator-involving-multiple-rhs/11194 "2018-05-28T01:42:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ReidAtcheson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/reidatcheson/32/4241_2.png) [@ReidAtcheson](https://discourse.julialang.org/u/ReidAtcheson)\
**Post date:** [May 28, 2018, 1:42am UTC](https://discourse.julialang.org/t/umfpacklu-backslash-operator-involving-multiple-rhs/11194/1 "2018-05-28T01:42:21Z")

</div>

Hello,

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

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:  
[https://github.com/JuliaLang/julia/issues/19500](https://github.com/JuliaLang/julia/issues/19500)

but it’s over a year old.

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

Thank you

---

<div class="post-metadata">

**Author:** ![Ralph\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ralph_smith/32/10344_2.png) [@Ralph\_Smith](https://discourse.julialang.org/u/Ralph_Smith)\
**Post date:** [May 28, 2018, 4:41am UTC](https://discourse.julialang.org/t/umfpacklu-backslash-operator-involving-multiple-rhs/11194/2 "2018-05-28T04:41:34Z")

</div>

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:

```julia
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))
    end
    X
end

```

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

---

<div class="post-metadata">

**Author:** ![ReidAtcheson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/reidatcheson/32/4241_2.png) [@ReidAtcheson](https://discourse.julialang.org/u/ReidAtcheson)\
**Post date:** [May 28, 2018, 1:44pm UTC](https://discourse.julialang.org/t/umfpacklu-backslash-operator-involving-multiple-rhs/11194/3 "2018-05-28T13:44:33Z")

</div>

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.
