Example 10:Multiple PEs in a parallel channel

In this example of user-defined parallelism, each parallel channel is fused into multiple PEs.

The parallel transformation replicates operators A, B and C. The Src operator is given a splitter. Fusion places the siblings of operators A and B for each channel in their own PE. Fusion places the siblings for operator C in their own PEs. The Src and Snk operators are given their own PEs.
composite Comp10(input In; output C) {
  graph
    stream<Type> A = Functor(In) {}
    stream<Type> B = Functor(A) {}
    stream<Type> C = Functor(B) {
      config placement: partitionColocation(byChannel());
    }
}

composite Main10 {
  graph
    stream<Type> Src = Source() {
      config placement: partitionIsolation;
    }

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

    () as Snk = Sink(Out) {
      config placement: partitionIsolation;
    }
}

The Logical and Physical stream graphs for Example 10.

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.