Example 2: Explicit fusion of operators both inside and outside of a parallel region
In this example of user-defined parallelism, the Src operator is fused with both operators A and B, and their replicas. The Snk operator is in a PE by itself.
The parallel transformation replicates operators A and B. The Src operator is given a splitter to feed
the two parallel channels. Fusion places the Src operator with all the siblings of operators A and B in the same PE.
Threaded ports are inserted between the splitter output ports and the replicas of operator A. Fusion places the Snk operator
into its own PE.
composite Comp2(input In; output B) {
graph
stream<Type> A = Functor(In) {}
stream<Type> B = Functor(A) {}
}
composite Main2 {
graph
stream<Type> Src = Source() {
config placement: partitionColocation(“SrcAB”);
}
@parallel(width=2)
stream<Type> Out = Comp2(Src) {
config placement: partitionColocation(“SrcAB”);
}
() as Snk = Sink(Out) {
config placement: partitionIsolation;
}
}
