IBM Streams 4.2
Example 1: Fusion of operators within a parallel channel
In this example of user-defined parallelism, the application developer wishes to fuse the operators within a parallel channel into the same PE. The parallel transformation replicates the logical operators and fusion places operators from a given channel into the same PE.
In this example, parallel transformation replicates operators A and B and fuses their siblings from each channel into the same
PE.
composite Comp1(input In; output B) {
graph
stream<Type> A = Functor(In) {
}
stream<Type> B = Functor(A) {
}
config placement: partitionColocation(byChannel());
}
composite Main1 {
graph
stream<Type> Src = Source() {
config placement: partitionIsolation;
}
@parallel(width=2)
stream<Type> Out = Comp1(Src) {}
() as Snk = Sink(Out) {
config placement: partitionIsolation;
}
}
Note that, depending on the fusion mode, explicit colocation only guarantees that operators which are specified to be colocated will be colocated, but not necessarily isolated from other operators. In this example, operators from different channels within the parallel region could be placed in the same PE.