# Is there a way to use MKLPardisoSolver or other parallel solver with KLU?

**URL:** <https://discourse.julialang.org/t/is-there-a-way-to-use-mklpardisosolver-or-other-parallel-solver-with-klu/87382>\
**Category:** General Usage\
**Tags:** question\
**Created:** [September 16, 2022, 5:39pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-use-mklpardisosolver-or-other-parallel-solver-with-klu/87382 "2022-09-16T17:39:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amro](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Amro](https://discourse.julialang.org/u/Amro)\
**Post date:** [September 16, 2022, 5:39pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-use-mklpardisosolver-or-other-parallel-solver-with-klu/87382/1 "2022-09-16T17:39:20Z")

</div>

Does `MKLPardisoSolver` only accept matrix inputs?

```julia
A= sprand(10000, 10000, 0.1);
II= rand(10000, 2); # typeof(II) is Matrix{Float64} (alias for Array{Float64, 2})
V= zeros(10000, 2);  
ps = MKLPardisoSolver()
solve!(ps, V, A, II); # it works
II= vec(II); # typeof(V) is Vector{Float64} (alias for Array{Float64, 1})
V = vec(V);
solve!(ps, V, A, II); # it does not work
julia> ERROR: DimensionMismatch: matrix has 10000 rows, RHS has 20000 rows.

```

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [September 16, 2022, 5:59pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-use-mklpardisosolver-or-other-parallel-solver-with-klu/87382/2 "2022-09-16T17:59:08Z")

</div>

The error says `DimensionMismatch` and refers to the number of rows, not to matrix vs vector.

`V` and `II` should have 10000 rows, but when you turn them into vectors they have _20000_.

Try

```julia
II= II[:, 1]
V = V[:, 1]

```

instead of

> [@Amro](#):
>
> ```julia
> II= vec(II); # typeof(V) is Vector{Float64} (alias for Array{Float64, 1})
> V = vec(V);
> 
> ```

---

<div class="post-metadata">

**Author:** ![Amro](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Amro](https://discourse.julialang.org/u/Amro)\
**Post date:** [September 16, 2022, 6:30pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-use-mklpardisosolver-or-other-parallel-solver-with-klu/87382/3 "2022-09-16T18:30:27Z")

</div>

Thank you very much for your reply. I continued to use the `MKLPardisoSolver` with KLU, but it seems it can only accept SparseMatrix. Is that correct?

- Any way now to solve in parallel with klu?

```julia
julia> factor = klu(A_Mat);
julia> @btime solve!(ps, $V_Mat, $factor, $I_Mat);
ERROR: MethodError: no method matching solve!(::MKLPardisoSolver, ::Vector{Float64}, ::KLU.KLUFactorization{Float64, Int64}, ::Vector{Float64})

```
