Jump to content

  • Log In with Google      Sign In   
  • Create Account


OpenCL Continuous Kernel?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 jeff8j   Members   -  Reputation: 591

Like
0Likes
Like

Posted 21 November 2012 - 07:14 PM

I am just starting to learn how to use opencl and from what I can tell there doesnt seem to be a way to run the kernel and read/write the buffers constantly I only see ways of running the kernel then getting the response and restarting the kernel which to me would seem like a huge waste if say some of the threads take longer than others wouldn’t the done ones have to sit around waiting?

Firefox youtube video and audio downloader MP3 MP4 OGG WEBM

https://addons.mozilla.org/en-US/firefox/addon/simple-youtube-converter/


Sponsor:

#2 Yrjö P.   Crossbones+   -  Reputation: 1410

Like
0Likes
Like

Posted 23 November 2012 - 11:06 AM

That's quite hard to read because there's no punctuation. Even though I'm reasonably sure where you intended your sentences to end, I'm confused. There's a question mark at the end but the sentences do not seem to form a question of any kind.

#3 Erik Rufelt   Crossbones+   -  Reputation: 2768

Like
0Likes
Like

Posted 23 November 2012 - 12:38 PM

It won't matter, if you have lots of work-items, which you should have. The threads that complete the kernel just restart and run it again for another work-item, so if you have a million work-items and a thousand threads it won't even be noticeable if one of those threads takes 100x longer than the others, as the others will run 1000 times anyway. If you only have as many work-items as there are cores, then yes all the others will wait for the slowest one, but if you have such a complex kernel that's run so few times then OpenCL probably isn't the right tool for the job. In that case, either do it on the CPU instead or try to change your kernel into a smaller kernel that runs 10x as many times and does part of the work each time.

Edited by Erik Rufelt, 23 November 2012 - 12:42 PM.


#4 jeff8j   Members   -  Reputation: 591

Like
0Likes
Like

Posted 23 November 2012 - 12:44 PM

Hi Stroppy
your absolutely correct I wrote it on the way out the door and was pretty exhausted sorry about that.

Hi Erik
That does make sense I wasnt thinking about it that way until today and realize that I cant think of it as a function to a program but an entire program it self.

Another thought is what if I want results back as fast as possible then I would have to stop all the threads so the buffer could be read correct?
Then in that scenario it would have to restart the kernel since I had to stop everything to be read. Or is their a way to read the output but continue processing?

Firefox youtube video and audio downloader MP3 MP4 OGG WEBM

https://addons.mozilla.org/en-US/firefox/addon/simple-youtube-converter/


#5 Bacterius   Crossbones+   -  Reputation: 6998

Like
0Likes
Like

Posted 23 November 2012 - 03:11 PM

You cannot interrupt a kernel in progress except by crashing the driver (and losing all your output buffers in the process). GPU's do not support that kind of execution yet. What I usually do when I need my application to be responsive is to design the kernels to do the absolute minimum amount of work possible in a single kernel enqueue, and just submit them to the card a lot faster, that way I can interrupt it CPU-side whenever and have everything stop quickly.

As for reading back, I suppose you could copy the output buffer to a temporary buffer (still GPU-side), keep launching your kernels and read from that, so that you could still get your card to work while DMA-copying the last execution's results to the CPU, but be wary that if your kernels finish faster than you can actually get your output back to the CPU (for a discrete card, that's generally 4GB/s bandwidth) you will run out of buffer memory, so it's not a great idea.

"The best comment is a deleted comment."





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS