Patent ID: 7620945

Claim:
A method for detecting and compiling parallelized generic reduction operations in a program, wherein a reduction operation is an operation that can be divided into a group of sub-operations each of which can be performed in parallel, comprising: detecting a generic reduction operation in the source code of the program; identifying a set of reduction variables upon which the generic reduction operation will operate; identifying a set of initial values for the set of reduction variables; identifying a user-specified merge operation for the generic reduction operation that merges partial results from the parallel generic reduction operations into a final result; and compiling the source code into a form which facilitates executing the generic reduction operations in parallel and facilitates executing the user-specified merge operation to merge the results of the generic reduction operations; wherein the user-specified merge operation facilitates performing merge operations for reduction operations that involve one or more variables and are non-commutative or non-associative.