Could anyone please confirm? A \ B is multi-threaded for dense matrices but single-threaded for sparse matrices. I watched the Resource Monitor in Windows 10 in both cases and saw only activity on 1 core in the case of sparse matrices (Matlab 2017a). If this is true, is there any way to get multi-threading on sparse \ operation?

 採用された回答

John D'Errico
John D'Errico 2017 年 8 月 18 日

0 投票

Backslash works in an automatically multi-threaded form ONLY on dense matrices, and only for systems that are sufficiently large. I recall verifying this fact, although it may change in some future release.
I believe there is currently nothing you can do to force multithreading for a sparse system solve. Even, for example, if you have the parallel processing TB, you still cannot break the problem up.

3 件のコメント

Tung-Duong
Tung-Duong 2017 年 8 月 18 日
Thank you for the confirmation. My A is about 10000 x 3000. I thought of using the gpu instead with gpuArray(A) \ gpuArray(B), but I got the following error:
Error using \ Sparse MLDIVIDE only supports sparse square matrices divided by full column vectors.
It's odd because A is square and non-singular. I can do full(A) \ full(B) without any problem.
In any case, you might look into the gpu for parallelization. I just don't understand why I'm having problem with it.
Joss Knight
Joss Knight 2017 年 8 月 18 日
編集済み: Joss Knight 2017 年 8 月 18 日
For sparse solves on the GPU only a vector RHS is currently supported. This is because that is what the underlying library (cusolver) supports. So B has to be a vector. Also you say A is non-square in one paragraph and then you say it's square in the next. At the moment, only square A is supported.
Tung-Duong
Tung-Duong 2017 年 8 月 28 日
Sorry, the "A" in the division is square. It's built from a non-square submatrix as [I A; A' 0], which is square and non-singular. So I should be able to do "A"\B on the CPU but can't.

サインインしてコメントする。

その他の回答 (1 件)

guoliang song
guoliang song 2020 年 1 月 28 日

0 投票

I also have this problem and it seems very strange.
a\b (a is about 60k*6k)
On my old PC(i7/4core,matlab2017). It can use all 4 core.
On my new PC(i9/10core,matlab2017). It can only use 1 core.
Same result in matlab2019b.

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

質問済み:

2017 年 8 月 17 日

回答済み:

2020 年 1 月 28 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by