Patent ID: 7523293

Claim:
A computer-implemented method of programming a computer system to execute an algorithm, wherein a plurality of program instructions correspond to the algorithm and wherein the plurality of program instructions comprises a parallel code block having n virtual threads, the computer-implemented method comprising: compiling the plurality of program instructions into a plurality of computer instructions adapted to control the computer system to: concurrently initiate execution of k physical threads by generating a thread enable signal in a form of a spawn command and assigning a virtual thread identification number to each physical thread; retrieve a series of spawn-join instructions in response to the spawn command, each spawn-join instruction corresponding to a virtual thread and including a join command to signal termination of the corresponding virtual thread; execute respective series of virtual threads in parallel and order-independently using the physical threads; and calculate a prefix sum based on a terminating thread of the k physical threads and assign a new virtual thread identification number based on the prefix sum calculation; wherein when the number of k physical threads is less than the number of n virtual threads, issue a thread enable signal in a form of a spawn-recur command when at least one join command has been executed, and wherein in response to the spawn-recur command, commence recurrent execution of the series of virtual threads with the new virtual thread identification number prior to termination of all virtual threads of the spawn command.