Example 11: Replicated operators in the same channel

In this example of user-defined parallelism, the Src operator from outside the parallel region is fused with some of the sibling operators in the parallel region.

This example is similar to Example 10 except that the Src operator, which is outside the parallel region, is fused with operators A and B from inside the parallel region.
composite Comp11(input In; output C) {
  graph
    stream<Type> A = Functor(In) {
      config placement: partitionColocation(“SrcAB”);
    }
    stream<Type> B = Functor(A) {
      config placement: partitionColocation(“SrcAB”); 
    }
    stream<Type> C = Functor(B) {
      config placement: partitionColocation(byChannel()); 
    }
}

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

    @parallel(width=2)
    stream<Type> Out = Comp11(Src) {}
    () as Snk = Sink(Out) {
      config placement: partitionIsolation;
    }
}

The Logical and Physical stream graphs for Example 11.

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.