cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

thesquiff
Journeyman III

Restrict domain of execution?

Hi,

Say I have a 1D stream of 256 elements.

In Brook+ is there any way I can call a kernel to operate on just the last 128 of these elements?

Thanks.

0 Likes
5 Replies
ryta1203
Journeyman III

Check the Stream Computing User Guide that comes with the SDK, try pages 2-18 to about 2-20.

Also, you may want to take a look at the "Domain" and "ExecDomain" samples that come with the SDK.
0 Likes

Thanks for the reply. Turned out I had updated by SDK but not my programming guide...

Now I had a kernel which creates a substream:

//assume 2D 256x256 input stream
kernel void substream(float inputStream<>, int startIndex, out float outputStream[]) {
    int idx,idy;
    int index;
    idx = instance().x;
    idy = instance().y;
    index = idy*256 + idx;
    outputStream[index-startIndex] = inputStream;
}

 

and call the kernel as follows:

substream.domainOffset(index);
substream.domainSize(256);
substream(textstream, index, targetStream);

where index is the index within the larger stream "textstream" where the substream should begin, and targetStream is the new substream of size 256.

Everything compiles OK without errors or warnings, but the substream I get is all zeros.

When I put the kernel code into KernelAnalyzer, all parameters are listed as N/A for the HD2400 (I have a 4870 on the way). Does the HD2400 not support scatter?

 

0 Likes

Just a quick remark, isn't it what you're trying to achieve ???

 

kernel void substream(float inputStream[], int startIndex, out float outputStream<> {
    int idx = instance().x;
    outputStream = inputStream[index+startIndex];
}

0 Likes

Your domain size seems to be wrong. Both, domainOffset and domainSize are uint4 parameters. You have specified a domain size of (256, 0, 0, 0), that is wrong and it has to be (256, 1, 1, 1).

I think if you check error on your output stream, you should see an errorLog attached to it. Take a look at tutorials coming with SDK under \samples\CPP\tutorials\ExecDomain and \samples\CPP\tutorials\ScatterStreamKernel.

Yes, HD2400 doesn't support scatter.

0 Likes

Thanks as always for the useful replies. jean-claude, yes that is exactly what I ended up with after I thought about it some more.

 

Thanks

0 Likes