简体   繁体   中英

Matlab GPU/CUDA operations using a shared matrix data

Is there any way to do an arrayfun with a shared matrix in a gpuArray type?

In my case I wanted to make the sum of two or more columns of a gpuArray matrix, but i dont know how to implement in a gpuFunction , arrayfun is the best option?

I wanted to make this easy operation in a CUDA because I need to make a million of this kind of operations with the different combinations.

Thank you very much.

Im going to explain the problem better.If you see my problem is like that

functionarrayfun = @(row)functionMex(data1,data2,row );

i = 1:length(tablaCombinaciones(:,1));%from 1 to end of rows

ratio = arrayfun(functionarrayfun,i);

Error using gpuArray/arrayfun Indexing is not supported. error at line: 6

Arrayfun and bsxfun work with a gpuArray:

See the example:

A = gpuArray.rand(100,2);
B = A(:,1);
C = A(:,2);
bsxfun(@plus,A(:,1),A(:,2))
arrayfun(@(x,y)x+y,A(:,1),A(:,2))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM