OpenCL (JOCL) - 2D calculus over two arrays in Kernel
I'm asking this here because I thought I've understood how OpenCL works
but... I think there are several things I don't get.
What I want to do is to get the difference between all the values of two
arrays, then calculate the hypot and finally get the maximum hypot value,
so If I have:
double[] arrA = new double[]{1,2,3}
double[] arrB = new double[]{6,7,8}
Calculate
dx1 = 1 - 1; dx2 = 2 - 1; dx3 = 3 - 1, dx4= 1 - 2;... dxLast = 3 - 3
dy1 = 6 - 6; dy2 = 7 - 6; dy3 = 8 - 6, dy4= 6 - 7;... dyLast = 8 - 8
(Extreme dx and dy will get 0, but i don't care about ignoring those cases
by now)
Then calculate each hypot based on hypot(dx(i), dy(i)) And once all these
values where obtained, get the maximum hypot value
So, I have the next defined Kernel:
String programSource =
"#ifdef cl_khr_fp64 \n"
+ " #pragma OPENCL EXTENSION cl_khr_fp64 : enable \n"
+ "#elif defined(cl_amd_fp64) \n"
+ " #pragma OPENCL EXTENSION cl_amd_fp64 : enable \n"
+ "#else "
+ " #error Double precision floating point not supported by OpenCL
implementation.\n"
+ "
No comments:
Post a Comment