AnsweredAssumed Answered

Idiot's guide to OpenCL with c++

Question asked by jazpearson on May 24, 2012
Latest reply on May 26, 2012 by Jawed

Hi,

 

I am a c++ programmer, but still very much learning. My experience with OpenCL is nill and my experience of trying any hello world opencl tutorials isn't great. I can never get them working. I can get the sample code working (from the sdk installs), but i'd like to be able to do something a bit more simple before i can delve into something more complicated.

 

I've just ordered the book "heterogeneous computing with opencl", and hopefully this will help somewhat. However, what i'd really like, to get started is an idiot's guide to opencl.

 

For example: let's say that i want to add all the numbers up from 1 to 100. In c++, this is obviously very simple. A straight forward for loop would suffice.

 

int total = 0;
for (int i = 1; i <= 100; i++)
  total += i;

 

But how could i do this in opencl properly?

 

Once i can get an understanding of the very basics, then i'll be able to get going.

 

What header files are needed? What opencl files do we need?

 

I appreciate your help.

Outcomes