Borrar filtros
Borrar filtros

Sparse for gpuArray problem

1 visualización (últimos 30 días)
shahrizan jamaludin
shahrizan jamaludin el 8 de Mzo. de 2016
Comentada: Joss Knight el 21 de Mzo. de 2016
Hello, i got problem with the code below:
pix=pix1; %pix1 is gpuArray with size 5194x2
P1=pix(:,2); %gpuArray with size 5194x1
P2=pix(:,1); %gpuArray with size 5194x1
spr=sparse(P1,P2,1,size(A,1),size(A,2));
%Error using gpuArray/sparse. Too many input arguments
but if i put "gather", it shows no error.
pix=pix1; %pix1 is gpuArray with size 5194x2
pix=gather(pix); % double with 5194x2
P1=pix(:,2); %double with size 5194x1
P2=pix(:,1); %double with size 5194x1
spr=sparse(P1,P2,1,size(A,1),size(A,2));
What went wrong? Any limitation for sparse in gpuArray? My GPU is 4GB

Respuesta aceptada

Joss Knight
Joss Knight el 8 de Mzo. de 2016
Yes, in R2015b the five-argument form of sparse is not supported for gpuArray. See help gpuArray/sparse.
Now that it's out you can upgrade to R2016a, which does support the five-argument form of gpuArray/sparse.
  2 comentarios
shahrizan jamaludin
shahrizan jamaludin el 8 de Mzo. de 2016
Thanks for your help.
Joss Knight
Joss Knight el 21 de Mzo. de 2016
By the way, in R2015b you can use accumarray, which has very much the same syntax as the 5-argument form of sparse. All you do is combine i and j into one matrix, also combine m and n into one size input, and specify the 6th argument as true (output sparse matrix), namely:
S = accumarray([i j], s, [m n], [], [], true);
is equivalent to
S = sparse(i, j, s, m, n);

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by