If you want something to run fast on the GPU, you code it in a language that can run entirely on the GPU. Not Matlab.
If you want something to run fast on the GPU, you code it in a language that can run entirely on the GPU. Not Matlab.
in our case the matlab code had explicit loops (in a sense i was lucky - the inner kernel operations were messy enough to need explicit coding, but regular enough to be handled efficiently on a gpu) and that's what really kills you (because you're bouncing out of optimised c code into their interpreter). just moving from matlab to c (on the cpu) also gave us a significant speedup.
what i'm saying, in a slow rambling way, is that calculating a bunch of sines should be as fast in matlab as in hand-coded c or opencl (on gpu and cpu respectively). because that can be expressed as a vector operation and matlab will have invested a lot of time and effort into making that code fast.
If in C, C++, Fortran, Python, use LibJacket. Learn more, http://accelereyes.com/libjacket_tour
Disclaimer: yes, i work on both of those :)