I’d like to bring up a silly question. Do you know if kernels, that OpenCL operates, can each print out a text string? Assuming the orders of strings are not important. If multiple kernels can print text simultaneously then print out a document to the screen can be quicker.
You can output your strings into pre-prepared buffers and after kernel is done, use them as you wish (for example “print” them). What do you mean to the screen anyways? :-) Use DirectX, OpenGL, GDI or your OS API or whatever for that, no?
Thank you for the reply.
What I meant is that in Visual Studio Console program, without OpenCL, program can print-to-screen using “printf()” for example. This function call is a bottle-neck in multithread programs because threads have to wait for the available IO.
With OpenCL, is there a way for multithread simultaneously print-to-screen using GL or any mean to overcome the bottle neck of IO?
I think you’re approaching this incorrectly. Even if you could print to screen using OpenCL, whether it’s OpenCL or OpenMP which has multiple threads that print to screen, all will require the single resource before it can print, so it will wait and serialize. Think of OpenCL as a way to use multiple resources more efficiently because you now have the ability to use them as such (ie, the multiprocessors/cores in the GPUs).
I got the ideas. Thank you for the answers.
A really tricky way to do this is to use AMD Stream SDK version 2 and use CPU as the OpenCL device, which would allow you to printf().