Hi:
We need to modify part of the stream . Actualy we only need to process some of the elements.
Take a simple example:
Here is the data:
{ 1 , 2 , 5 , 2 , 2 , 5 , 6 , 5 , 6 , 8 , 9 , 6 , 3 , 5 }
I want to change all of the 5 into 50. How could i do that without copying the whole stream to another or using scatter kernel.
You can probably use read-write aliasing at runtime with BRT_PERMIT_READ_WRITE_ALIASING env variable and use regular input and output stream in kernel.
Actually i've used the varable. There are some questions:
1. How about the performance, we can't afford cost more than 5 ms each call.
2. Is there something else to be set to enable the functionality? Because i've set the varable , but the simple kernel still got error. here is part of the code:
Stream<float4> data( 2 , dim );
data.read( cpudata );
simpleTestKernel( data , data );
There are some error after the kernel is called.
Kernel Execution Error: Input stream is same as output stream.
Binding kernels read-write is prohibited.
Environment variable BRT_PERMIT_READ_WRITE_ALIASING can be used to allow input-output aliasing.
But the result can be unpredictable.
3. What does it mean by "But the result can be unpredictable"?
Thanks for ur attension.
It says result can be unpredictable because Stream computing model would not work if you use gather or scatter operations and both input and output are same.
Not sure about Vista, but this environment variable works fine and allows input/output aliasing in XP.
Sorry, Posted in wrong thread.