Patent ID: 7689977

Claim:
A method for providing an OpenMP reduction implementation, comprising: creating an aggregate of at least one reduction variable in a parallel region or a work-sharing construct; defining a pointer variable, the pointer variable pointing to a dynamic array of the aggregate; creating an initialization routine, an outlined routine and a reduction accumulation routine; replacing the parallel region or the work-sharing construct with a runtime routine, the runtime routine taking a plurality of arguments including an address of the initialization routine, an address of the outlined routine, an address of the reduction accumulation routine, an address of the pointer variable, and a size of the aggregate; executing the runtime routine when the at least one reduction variable is in the parallel region, further comprising: allocating a memory for the dynamic array by a PowerPC Unit (PPU); executing the initialization routine by the PPU; executing the outlined routine by a plurality of Synergistic Processing Unit (SPU) threads; and executing the reduction accumulation routine by the PPU; and executing the runtime routine when the at least one reduction variable is in the work-sharing construct, further comprising: allocating a memory in the PPU memory space for the dynamic array by a first SPU thread to reach the work-sharing construct; executing the initialization routine by each of the plurality of SPU threads; executing the outlined routine by each of the plurality of SPU threads; and executing the reduction accumulation routine by a last SPU thread to leave the work-sharing construct.