Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 12 Jul 2012
Offline Last Active Feb 18 2013 07:17 AM

Topics I've Started

OpenCL is very slow comparing to cpu.

31 January 2013 - 08:48 AM

Hello. I've created my first program with opencl.

__kernel void vector_add_gpu (__global const float* a, __global const float* b, __global float* c, int iNumElements){ // get index into global data array int iGID = get_global_id(0); // bound check (equivalent to the limit on a 'for' loop for standard/serial C code if (iGID < iNumElements) { // add the vector elements c[iGID] = a[iGID] + b[iGID]; }}
I have a quite big buffer with numbers(about 240 mbyte). Opencl spends in 5 time more then a cpu loop. Is it ok or something is wrong? If i have more complicated function(c[iGID] = a[iGID] + sqrt(b[iGID] * b[iGID]);) than difference is much bigger(in 150 times) :)Thank you.


P.S. sorry my previous case was wrong i forget to put opencl file to the folder. :)