# 利用库包Pardiso.jl求解方程组时，设置线程数的问题

``````    using SparseArrays
using Pardiso

ps = MKLPardisoSolver()
set_nprocs!(ps, 8)
get_nprocs(ps)
A = sparse(rand(1000, 1000))
B = rand(1000, 2)
X = zeros(1000, 2)
solve!(ps, X, A, B)
``````

``````julia>  using SparseArrays

julia>  using Pardiso

julia> ps = MKLPardisoSolver()
MKLPardisoSolver:
Matrix type: Real nonsymmetric
Phase: Analysis, numerical factorization, solve, iterative refinement

julia>     set_nprocs!(ps, 8)

julia>     get_nprocs(ps)
2

julia>     A = sparse(rand(1000, 1000))
1000×1000 SparseMatrixCSC{Float64,Int64} with 1000000 stored entries:
[1   ,    1]  =  0.536508
[2   ,    1]  =  0.223994
[3   ,    1]  =  0.27551
[4   ,    1]  =  0.779583
⋮
[996 , 1000]  =  0.475305
[997 , 1000]  =  0.421885
[998 , 1000]  =  0.818858
[999 , 1000]  =  0.657867
[1000, 1000]  =  0.713921

julia>     B = rand(1000, 2)
1000×2 Array{Float64,2}:
0.758533  0.461676
0.794269  0.646466
0.145926  0.474638
0.41682   0.709873
0.478481  0.622945
⋮
0.171621  0.74124
0.257501  0.586585
0.825143  0.253205
0.600026  0.250749

julia>     X = zeros(1000, 2)
1000×2 Array{Float64,2}:
0.0  0.0
0.0  0.0
0.0  0.0
0.0  0.0
0.0  0.0
⋮
0.0  0.0
0.0  0.0
0.0  0.0
0.0  0.0

julia>     solve!(ps, X, A, B)
1000×2 Array{Float64,2}:
-0.771206   -3.50291
0.0667699   0.425585
-0.314671   -0.128101
0.317924    2.32667
1.53918     3.54766
⋮
1.88157     1.41786
1.09144    -1.20533
1.64837     1.90146
0.256798   -2.55176
``````