[ADMB Users] Does CUDA suck? answer NO!
davef at otter-rsch.com
Sat Sep 3 16:05:40 PDT 2011
First there is an error in the code. It should read
However I thought that maybe the problem is that addition is too
trivial compared to the
overhead of moving things to the GPU and back. I changed the function to
and lo! the el cheapo GPU is faster (about 6 times faster).
So how hard is a vector pow. All that was necessary was to take the
function and modify it to
__global__ void VecPow(const double* A, const double* B, double* C, int N)
int i = blockDim.x * blockIdx.x + threadIdx.x;
if (i < N)
C[i] = pow(A[i],B[i]);
Code is attached. Note I use mypow just to avoid clash with existing
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 7605 bytes
Desc: not available
More information about the Users