cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

erman_amd
Journeyman III

Brook+ and OpenCL

How to represent 2D array (matrix) to 1D stream?

Hi,

This is my first post here. I just started to use OpenCL on AMD platform and want to compare it with Brook+. Also just bought a 5870 GPU to start programming.

I tried to a look at the opencl examples provided by the SDK to find out some differences between OCL and Brook+.

I have a very very basic question.

-In Brook+, there is a domain of execution? is it the same concept with NDRange in OCL)

-Brook+ uses the term "stream". Most of cases it represents the input and output using "1D stream".  If I want to port an OCL apps to Brook+, how to represent 2D array (matrix) to 1D stream?

thanks.

0 Likes
4 Replies
nou
Exemplar

do you used Brook before? if not then forget about it.

to get 2D you have two options. regular buffer and image2d_t.

with buffer you just flaten it from 2D into 1D. like array[y*width+x];

with image2d_t you put x,y as int2 vector into write/read_image functions.

0 Likes

I learn StreamC before (used for programming Imagine stream processor). I think the concept is almost the same with Brook+.

It represents inputs as 1D stream, process it on the kernel, and write to output stream. I'm not sure whether the concept can be applied directly to OpenCL data parallel programming because when it seems the example provided in OpenCL is excuted using 2D NDRange.

btw, i will try the "array[y*width+x]". The x is get_global_id(0) and y is get_global_id(1), right?

 

0 Likes

ermen,

I am not familiar with Brook. But in case of openCL, an NDRange is defined for any problem. You can have 1D,2D or 3D NDranges representing threads/workitems. The threads are grouped in workgroups. Workgroups are entity inside which threads are executed together and synchronized.

Refer to Chapter 1 of OpenCL Programming guide for more details about openCL. I hope some of your doubts are cleared. I didn't get what exactly you want to ask in the last line, but it is logically correct.

 http://developer.amd.com/gpu/AMDAPPSDK/documentation/Pages/default.aspx

0 Likes

yes x = get_global_id(0); y = get_global_id(1);

0 Likes