Example 3: Operator replication for an entire application

In this example of user-defined parallelism, the application developer wishes to fuse all operators together.

The parallel transformation replicates the operators A and B. The Src operator is given a splitter to feed the two parallel channels. Fusion places all operators in the same PE. Threaded ports are inserted between the splitter output ports and the replicas of operator A.
composite Comp3(input In; output B) {
  graph
    stream<Type> A = Functor(In) {}
    stream<Type> B = Functor(A) {}
}

composite Main3 {
  graph
    stream<Type> Src = Source() {
      config placement: partitionColocation(“SrcABSnk”);
    }
      @parallel(width=2)
    stream<Type> Out = Comp3(Src) {
      config placement: partitionColocation(“SrcABSnk”);
    }
    () as Snk = Sink(Out) {
      config placement: partitionColocation(“SrcABSnk”);
    }
}

The Logical and Physical streams graphs for Example 3.