next up previous contents
Next: Creating the loops Up: Loop parallelization Previous: A quick heuristic   Contents

Going parallel

At this point we are certain that we want to parallelize. Still it is not entirely possible that we actually can. We call the sequence parallelizer to get the loop code parallelized.

If the sequence parallelizer returns something that is not strictly one parallel block with a number of tasks, then something is wrong. If we receive any serial sequences, we are beginning to duplicate code into separate loops, and that is something we don't want. We exit with the parallelized loop code here, if that happens.

We may want to duplicate serial code, if it the execution of it is fast enough, and if the cost of the code we actually can parallelize justifies this. It should be simple to implement, but we need some sort of heuristic for this. We need an execution cost estimate.