IBM Streams 4.2

Example 6: Multiple parallel regions with differing fusion

In this example of user-defined parallelism, one parallel region is fused with the Src operator while the other is fused by channel.

The parallel transformation replicates operators A and B for the first parallel region, and operators C and D for the second parallel region. The Src operator is given two splitters, one to feed each parallel region. Fusion places the the Src operator, along with all siblings of operators A and B in one PE. Fusion places the siblings for operators C and D for each channel in their own PE. Fusion places the Snk operator into its own PE. Threaded ports are inserted between the output ports of one splitter and the replicas of operator A.
composite Comp6_1(input In; output B) {
  graph
    stream<Type> A = Functor(In) {}
    stream<Type> B = Functor(A) {}
}

composite Comp6_2(input In; output D) {
  graph
    stream<Type> C = Functor(In) {}
    stream<Type> D = Functor(C) {}
}

composite Main6 {
  graph
    stream<Type> Src = Source() {
      config placement: partitionColocation(“SrcAB”);
    }

    @parallel(width=2)
    stream<Type> Out_1 = Comp6_1(Src) {
      config placement: partitionColocation(“SrcAB”);
    }

    @parallel(width=2)
    stream<Type> Out_2 = Comp6_2(Src) {
      config placement: partitionColocation(byChannel());
    }

    () as Snk = Sink(Out_1, Out_2) {
      config placement: partitionIsolation;
    }
}

The Logical and Physical stream graphs for Example 6.

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 regions could be placed in the same PE.