Kernel not processing half of the elements on GPU, works fine on CPU

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Kernel not processing half of the elements on GPU, works fine on CPU

Giovanni Idili
Hello everyone,

I have a simple JOCL demo [http://goo.gl/aYBMi] adapted from the HelloJOCL sample [http://goo.gl/cVR6m] (I shall mention that the HelloJOCL sample works OK on the same GPU).

I am having a weird problem where half of the elements in my queue are not being processed (or so it seems) when running on GPU, but everything works ok when switching to CPU.

I tried to change the number of elements and no matter how few I use only the first half gets processed correctly, while the rest is apparently picking up default values for the output buffer. Even though the init vectors are correctly initialized when I peek at them, it almost looks like the second half of the vector values are being passed to the kernel as default values (doubles), but I am not really sure that those items are being processed by the kernel at all.

The kernel is quite simple [http://goo.gl/KiyyK], it's just a pass-through for one of the input buffers (I am only testing that I can invoke it OK) and I just assign the value from one of the input buffers to the relevant output buffer. I am inclined to think the kernel is not the problem since it works fine on CPU.

I know it's quite a bit of code to go through, so I am just asking if any of this rings a bell.

Any help appreciated!
Reply | Threaded
Open this post in threaded view
|

Re: Kernel not processing half of the elements on GPU, works fine on CPU

Giovanni Idili
Weirdest finding: if I change all the doubles to floats the problem seems to go away.

Does this make any sense at all?
Reply | Threaded
Open this post in threaded view
|

Re: Kernel not processing half of the elements on GPU, works fine on CPU

Michael Bien
I'll try to take a look at it this evening, at the first glance your code looks good.
Are you running a 64bit JVM?

best regards,
michael

On 05/15/2011 04:37 AM, John_Idol [via jogamp] wrote:
Weirdest finding: if I change all the doubles to floats the problem seems to go away.

Does this make any sense at all?


If you reply to this email, your message will be added to the discussion below:
http://forum.jogamp.org/Kernel-not-processing-half-of-the-elements-on-GPU-works-fine-on-CPU-tp2941599p2942405.html
To start a new topic under jogamp, email [hidden email]
To unsubscribe from jogamp, click here.
Reply | Threaded
Open this post in threaded view
|

Re: Kernel not processing half of the elements on GPU, works fine on CPU

Giovanni Idili
Thanks for having a look - after posting on the khronos forums about another issue I was having I was forced to switch to floats (apparently my GPU doesn't support doubles). After that it seems to work OK. I am kind of thinking that the issue was caused by lack of double support too, but it's very strange nonetheless, and I don't understand why were half of the stuff being processed correctly. Weird!

Now everything is working OK anyway ... but I already have another question that I will post soon :)
Reply | Threaded
Open this post in threaded view
|

Re: Kernel not processing half of the elements on GPU, works fine on CPU

Michael Bien
  yep i saw your post on the message board already :)

if you want to switch between double and single precision take a look at
the multi device demo and how the kernel was written.
https://github.com/mbien/jocl-demos/blob/master/src/com/jogamp/opencl/demos/fractal/Mandelbrot.cl

it uses doubles in host code (java app) and sets
kernel.setForce32BitArgs(true) for double->float conversion in the
kernel.putArg() methods. (+ it recompiles the program with different
compiler options)

best regards,
michael

On 05/17/2011 07:42 PM, Giovanni Idili [via jogamp] wrote:

>
> Thanks for having a look - after posting on the kronos forums about
> http://www.khronos.org/message_boards/viewtopic.php?f=37&t=3894 another
> issue I was having  I was forced to switch to floats (apparently my GPU
> doesn't support doubles). After that it seems to work OK. I am kind of
> thinking that the issue was caused by lack of double support too, but it's
> very strange nonetheless, and I don't understand why were half of the stuff
> being processed correctly. Weird!
>
> Now everything is working OK anyway ... but I already have another question
> that I will post soon :)
>