1. A computer-implemented method for partitioning an application program that comprises a plurality of statements, the method comprising: selecting a statement in the plurality of statements to analyze; if the statement is not a synchronization barrier instruction, then adding the statement to a current partition, or if the statement is a synchronization barrier instruction or if the statement is a start of a control-flow construct that includes a synchronization barrier instruction, then ending the current partition and storing the current partition in an output list of partitions; beginning a new current partition and repeating the steps of selecting, adding, and ending until all statements in the plurality of statements have been analyzed; annotating each statement in the application program with a corresponding variance vector that is a representation of a set configured to indicate thread dimensions on which the statement depends; and reordering statements in a partition in the output list of partitions to cause statements in the partition that have fewer dimensions in their corresponding variance vectors to precede statements in the partition that have more dimensions in their corresponding variance vectors.