Currently trying to write my first kernel - a simple program to compare two arrays of points (VBO’s).
Started by reading a bunch of docs, tutorials, examples, etc.
It all seemed fairly straightforward, but absolutely nothing works.
Utilized standard troubleshooting technique and simplified, single threaded, added prints.
Eventually got down to this:
kernel void testing123() {
int4 pi = (int4)(1, 2, 3, 4);
float4 pf = (float4)(0.25f, 0.5f, 0.75f, 1.0f);
printf("pi = (%d, %d, %d)
", pi.x, pi.y, pi.z);
printf("pf = (%1.4f, %1.4f, %1.4f, %1.4f)
", pf.x, pf.y, pf.z, pf.w);
}
Which outputs this:
pi = (1, 2, 3)
pf = (0.2500, 1.0000, 0.0000, 0.0000)
Or this:
kernel void testing123() {
int4 pi = (int4)(1, 2, 3, 4);
float4 pf = (float4)(0.25f, 0.5f, 0.75f, 1.0f);
float fa[3] = {1.0f, 2.0f, 3.0f};
printf("pi = (%d, %d, %d)
", pi.x, pi.y, pi.z);
printf("fa = (%1.4f, %1.4f, %1.4f)
", fa[0], fa[1], fa[2]);
printf("pf = (%1.4f, %1.4f, %1.4f, %1.4f)
", pf.x, pf.y, pf.z, pf.w);
}
Which outputs this:
pi = (1, 2, 3)
fa = (1.0000, 0.0000, 0.5000)
I could perhaps understand missing output as a flushing problem.
But the values shown here is totally beyond my comprehension.
I’d be very grateful if someone would enlighten me…
Thanks