15,898,134 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
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