필터 지우기
필터 지우기

Sparse arrays on GPU?

조회 수: 4 (최근 30일)
Ajay Shenoy
Ajay Shenoy 2015년 7월 18일
편집: Amin zaami 2022년 6월 7일
Hello,
According to the Matlab documentation ( http://www.mathworks.com/help/distcomp/run-built-in-functions-on-a-gpu.html ), I can create a sparse gpuArray by "either by calling sparse with a gpuArray input, or by calling gpuArray with a sparse input." Neither of these seems to work:
x = sparse([0 2 0; 0 5 0; 0 1 0])
x =
(1,2) 2
(2,2) 5
(3,2) 1
m = gpuArray(x)
Error using gpuArray
Only full arrays of fundamental numeric types or logical types are supported for
GPU arrays.
Or alternatively:
x = gpuArray([0 2 0; 0 5 0; 0 1 0])
x =
0 2 0
0 5 0
0 1 0
X = sparse(x)
Undefined function 'sparse' for input arguments of type 'gpuArray'.
Am I doing something wrong?
Thanks!

채택된 답변

Matt J
Matt J 2015년 7월 18일
편집: Matt J 2015년 7월 18일
Make sure you are using a recent enough version of MATLAB. Sparse gpuArrays weren't always supported.
  댓글 수: 2
Ajay Shenoy
Ajay Shenoy 2015년 7월 18일
편집: Ajay Shenoy 2015년 7월 18일
Which was the first version to support sparse gpuArrays? I have Matlab R2014b and version 6.5 of the parallel computing toolbox. Thanks - A.
Walter Roberson
Walter Roberson 2015년 7월 18일

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

추가 답변 (1개)

Amin zaami
Amin zaami 2022년 6월 7일
편집: Amin zaami 2022년 6월 7일
See example below for sparse on GPU:
sparse(41200,41200,gpuArray(1),41200,41200);
  • first 2 arguments for size, last two for memory,

카테고리

Help CenterFile Exchange에서 GPU Computing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by