Click here to Skip to main content
15,884,353 members

Comments by Ken Domino (Top 1 by date)

Ken Domino 5-Aug-11 7:51am View    
Ah... Figure 6(a) and (b) are both .cpp files. You can put them in separate files, or just merge them into one large .cpp file. To compile, you need to add a "-I" include option for finding the OpenCL include files. To link, you need to add a reference to the OpenCL library.

The example does not have a ".cl" file because it would then have to be read into a string (char *) for clLoadProgramWithSource(), using for example oclLoadProgSource()--which is not part of OpenCL. Instead, the kernel code is set as a string, which is passed to clLoadProgramWithSource(). There is also a bunch of code in Figure 6(b) in an "#else ... #endif" block. That code is for reading binary from a hacked version of the CLCC OpenCL compiler, but I don't use in this example. For clarity, I removed that stuff, and combined the code like I said. I'll updated the blog to contain a link to a MSVC Project to make it easier to build.

The MSVC++ Project is here: http://domemtech.com/code/pi-opencl.zip

Ken