Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

Journeyman III

What's the better way of modifying a sub-stream?


   I'm a beginner on Brook+ stream computing.
   What's the better way of modifying a sub-stream.

    1.  Stream<float4> subStream = mainStream.domain( 1 , 100 );
         kernelModify( subStream );

    2.  kernelModify.domainOffset( uint4( 1 , 0 , 0 , 0  );
         kernelModify.domainSize( uint4( 99 , 1 , 1 , 1 ) );
         kernelModify( mainStream );

   Each of the above method is done 1000 times in order to scale the cost time, the former one turned out to be faster than the second one?
   Is that right? What's the reason??
   Or is there a better way ??

   Any help is really appreciated!!

3 Replies
Adept I

What is the actual size of mainStream? I would assume second one should be better as domain operator would create a new stream and had to copy data from domain to parent after kernel invocation is finished.

But, if you are using large 1D stream (size > 8192), it would cause address virtualization to be enabled. That would require domain of execution to be implemented using multi-pass algorithm and it should be slower than first technique.


Actually , there are about 210000 float4 in my stream which is stored as two dimension stream.

i've only get the substream of ( 0 , 0 ) to ( 2 , 1 ).

But the latter one turned out to be faster which confused me a lot.


You should expect domain of execution to be faster as domain would require a copy between original to domain stream and vice-versa depending upon whether it is a input or output stream.