Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I do this kind of parallel computing on GPU?

I have a M*N integer matrix, which I need to traverse and compute this for every element M[i][j]:

The integer which appears most often in the submatrix from (i-k,j-k) to (i+k, j+k).

So the result is a matrix with each cell being the dominant number around [i,j] in original matrix.

The matrix could be very large, and I need to do this operation in a tight loop, so I want to minimize the operation time by parallel computing.

I know GPU is good at matrix multiplication, but it looks like this cannot be reduced to a simple matrix multiplication. (or can it?)

Is it possible to compute each cell in parallel on GPU? And if it is, I want to implement this in iOS, what programming interface should I use, Metal? OpenGL?

like image 367
NeoWang Avatar asked Mar 09 '17 03:03

NeoWang


1 Answers

Yes you can do this computation on GPU.

Metal seems to be for both graphical and general purpose computation. So you should be able to use it for your needs (here is an article introducing it: http://memkite.com/blog/2014/12/15/data-parallel-programming-with-metal-and-swift-for-iphoneipad-gpu/)

Accelerate can also fit our needs.

Hope this help.

like image 91
Guillaume Pascal Avatar answered Sep 20 '22 18:09

Guillaume Pascal