cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

rveldema
Journeyman III

brook+ allows reuse of stream objects?

stream reuse

Is it allowed to reuse stream objects as in:

 ============

kernel void work(input<>, out float[]) {...}

============
    brook::Stream<float> inputStream(rank, streamSize);
    inputStream.read(inputBuffer);

    unsigned int streamSizeScatter[] = {height, width};
    brook::Stream<float> outputStream1(2, streamSizeScatter);
    brook::Stream<float> outputStream2(2, streamSizeScatter);

   work(inputStream, outputStream1,  12345);

   // inputstream hasn't changed between these work() calls,

 // lets reuse it!

   work(inputStream, outputStream1, 6789);

=======================

The problem that I'm seeing in my application is lots of small arrays

being copied from host to GPU and back.

Reusing streams would help a lot!

 

Also, a stream output by one kernel and is used

as input to another kernel, is that data kept in GPU memory in the mean time

to reduce copying?

Cheers,

Ronald.

 

 

0 Likes
2 Replies
gaurav_garg
Adept I

Any changes done to streams are persistent across your application.

As you said reusing streams is a good way to avoid data transfers and it should just work fine with Brook+

0 Likes
ryta1203
Journeyman III

Yes, streams can be reused, like so:

stream1<100, 100>;

stream2<100, 100>;

kernel_call1(stream1, stream2);

kernel_call2(stream2, stream1);

 

0 Likes