Filter löschen
Filter löschen

sparse in cuda matlab shows bad performance

1 Ansicht (letzte 30 Tage)
俊凯 王
俊凯 王 am 5 Nov. 2021
Beantwortet: Joss Knight am 6 Nov. 2021
This question is simple
I understand that MATLAB solves sparse linear equations by multi wavefront method on CPU
like sparse_a Is a sparse b is a full vector then x can be computed by x=sparse_a\b
is there any method to let matlab compute sparse in gpu?
gpu_sparse_a=gpuArray(sparse_a ) b_gpu=gpuArray(b)
and then x=gpu_sparse_a\b_gpu
result shows that gpu compute sparse slower than cpu....why?is sparse in cpu transfer into gpu actually become a full matrix?
  5 Kommentare
俊凯 王
俊凯 王 am 5 Nov. 2021
easy code,randi sparse in cpu and gpu,if you run in matlab ,performance shows different,if M is larger ,Greater efficiency gap
俊凯 王
俊凯 王 am 5 Nov. 2021
Bearbeitet: 俊凯 王 am 5 Nov. 2021
and i wonder if the sparse solver on the CPU uses a multi-core CPU

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Joss Knight
Joss Knight am 6 Nov. 2021
It is often slower. The problem is that sparse factorizations create dense matrices...basically, it's hard to parallelize.
We generally advise to use the sparse iterative solvers, generally with preconditioners, instead. These are typically faster on GPU and CPU. Look for gmres, cgs, pcg and so on.

Weitere Antworten (0)

Kategorien

Mehr zu GPU Computing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by