how to deploy an external function (say filter) on GPU variable in row wise ?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
jagadeeshwar tabjula
el 23 de Nov. de 2021
Comentada: jagadeeshwar tabjula
el 24 de Nov. de 2021
Hello friends,
I have a matrix A of size 2000 X200000. I want to perform row wise operations on the matrix A using external functions (ex: exfun()). So far i am calling each row in a parfor loop and execute the function. After executing the each row output is saved in a matrix. (pasted few lines of code for ease of understanding). But it is very time consuming process, I would like to use GPU to speed up the row-wise operations. So could you please provide any suggestions or a code to use gpu for my job ? Thanks in Advance
A %MAtrix size of 2000X200000
parfor i =1:1:size(A,2)
row_data=A(i,:);
output(i,:)=exfun(row_data);
end
2 comentarios
Edric Ellis
el 24 de Nov. de 2021
Whether you can use the GPU to help here depends entirely on whether the operations in exfun are supported on the GPU. See https://www.mathworks.com/help/parallel-computing/run-matlab-functions-on-a-gpu.html for more.
I would also suggest that iterating over rows of a matrix is generally less efficient than iterating over columns. That's because MATLAB stores matrices in "column major" order - picking out a single column is a simpler operation. (Of course, far better to have exfun operate on the whole matrix, or even chunks of matrix). So, you might be better off transposing A before you start. Depending on the computational time needed by exfun, this might or might not be significant.
Respuestas (0)
Ver también
Categorías
Más información sobre GPU Computing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!