How `gpuArray` save sparse matrix when running Preconditioned conjugated gradient?

조회 수: 1 (최근 30일)
Hi, I am using cuda in Matlab to accelerate the Preconditioned conjugated gradient evaluation of "Ax = b". I'm glad to find the pcg without any preconditioner on GPU run faster (x6~7) than ichol preconditioned pcg on CPU. I would like to know how gpuArray allocate the sparse matrix on GPU, in CSR, ELL or any other format. I heard that the different storage format influences the evaluation speed. So I would like to compare these formats on my matrix to optimal my code. I found no option of these formats' setting in the function of gpuArray. I uncertainly speculate gpuArray may allocate the sparse matrix dynamically. Could you give some suggestion or document link of this problem?
Thank you.

채택된 답변

Joss Knight
Joss Knight 2021년 1월 24일
gpuArray currently stores sparse matrices internally in CSR format. This matches the NVIDIA cusparse routines that are used for basic algebra.
I don't know quite what you mean by dynamic allocation. All MATLAB variables are allocated dynamically in some sense, because they are not defined before the application is run. However, MATLAB uses a variety of pooling techniques to ensure actual dynamic allocations (such as calls to cudaMalloc) happen as infrequently as possible. If you are noticing some performance delays when data is copied to the device then sometimes the conversion between CSC (the CPU storage format) and CSR is responsible.
  댓글 수: 1
wei zhang
wei zhang 2021년 1월 25일
Thank you for your explanation. As your mention, I check the cusparse file and find it saves the sparse matrix in CSR format. The ELL or HYB format are deprecated, yet I don't know why they do this. The dynamicly allocation is just my immature speculation. I thought Matlab may analysis the shape, nnz , cluster property or any other matrix property at first, then save the sparse matrix in optimal way.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Distributed Arrays에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by