A part of reaction on my earlier post was: “VB Programmers span the whole range from hobbyists to scientists and professions. There is no reason that VB programmers should be left out of the loop in GPU programming. (…) CUDA and OpenCL are fundamentally lower level languages that do not have the same level of user-friendliness that VB gives, and so they require a bit more care to program. (…)“. I left out some parts, so I probably got the emphasis very wrong. However, it gave me an idea: what would a “Visual Basic Wizard for OpenCL” look like?
It is actually very interesting to think how to get GPGPU-power to a programmer who’s used to “and then and then and then”. How do you get parallel processing into the mind of an iterative thinker? Simplification is not easy!
By thinking about an OpenCL-wizard, you start to understand the bottlenecks of, and need for OpenCL initialization.
Actually it could better be built into an existing framework like OpenMP, or something alike in Python, Java, etc. Or the IDE could give hints that the standard-function could be replaced by a GPGPU-version. But we just want a wizard which generates “My First OpenCL Program”, which puts a smile on the face of programmers who use their mouse a lot.
The screens
I took some screenshots from an explanation how to do some Oracle-integration and edited them. I use the British spelling, so I hope nobody thinks these screens are from Microsoft.
We want a new project and luckily there is a “New OpenCL VB Project Wizard”. The great names of those wizards had always amazed me.

This is a default screen for the first page. Nothing exciting yet, but I hope the user will not press the “Finish” button yet, since they haven’t specified anything to generate yet! You can see the tab-labels I chose.

We can base the order of the functions on common-practice (if we have the data), or just make them arbitrary. We’ll gray out incompatible kernels to avoid problems. For each ‘function’, there are various kernel-templates in the library. I put a few here, but a category-like browser is probably better. I thought a lot about this step, as it’s the most crucial, but I leave it open for your comments now.

A wizard always wants to think for the user, so we provide an example stream to determine its type. The output can be streamed also, or be written to an XLS of course.
The first question asks in a roundabout way, “How to initialize?” A more extensive initialization at the start? Or reinitialized each time? The second question asks how aggressively the program can use resources. By selecting the precision, a lot will happen: we’ll need extensions, we’ll use different kernels, etc.
Which questions did I leave out? And for what reason?
- How many available devices will the program use? Default is all.
- Fall back to CPU? No, that would complicate the program enormously.

This list should be huge, like each line of each brand. But since we want it to be simple, we only list high-end devices. I know AMD Fusion is not on the market yet and the first version will probably not have a high-end GPU – but it would be great.

As you can see, the question about extensions are based on the demanded precision in the behavior-screen.
What does your ideal OpenCL Wizard look like?
Now you’ve seen the pictures, you probably have better ideas. While I was writing the final captions, I even edited some screens again. Please let me know what you think, since it will help others simplify their wrappers around OpenCL.
Edit 7-oct-2010: there actually exists something as described for CUDA in Visual Studio: Cuda VS Wizard.
Disclaimer: StreamHPC gives trainings in GPGPU/OpenCL. We like to show you how to learn GPGPU and OpenCL and like to share our enthusiasm via this blog, but of course our training is more thorough.
- How many available devices should be used?
- Fall back to CPU?
- Task-parallel

