Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

Journeyman III

Where should I start?

I have gone through ATI Stream SDK .pdf version available on net. I have just started playing with OpenCL SDK examples and doubts started comming in...

I noticed in some example author is adding some extra memories in his input. How do I get to know how much extra memory I should add? May be it's a very basic question but I could not hold my self and thought of asking.

E.g. In GlobalMemoryBandWidth project author is calculating size as

    cl_uint sizeElement = vectorSize * sizeof(cl_float); // I can understand this line but not rest of the calculation.

    cl_uint readLength = length + (NUM_READS * 1024 / sizeElement) + EXTRA_BYTES; // How I can be so sure about how much EXTRA_BYTES would be.

    cl_uint size = readLength * vectorSize * sizeof(cl_float);

3 Replies

Those bandwidth examples are a bit obtuse to follow, you're better off trying to find simpler examples that do real work on an obvious amount of data (e.g. all pixels in an image, all elements of an array).

If on the other hand you don't already know how to programme in C or about dynamic memory, you might want to start there.  There are numerous resources on the internet.

Thanks a lot notzed.

I know c programming and dynamic memory.

So are you saying I need not to allocate extra memory for my input/output buffer?


ok goodo.

You only need to allocate what your algorithm uses based on the data type you're processing; those examples calculate the amount based on test parameters like 'number of loops', 'number of work items' and so on but those types of parameters aren't applicable to real applications whose data is externally supplied.

Treat createBuffer/etc the same as as you might malloc() or new()