para17 - Parallel Algorithms III (17) Parallel Algorithm...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Parallel Algorithm Pseudocode Conventions for the PRAM Model While there is no standard for parallel algorithm design, there are several conventions that are widely adopted for describing parallel algorithms. Since the PRAM model exhibits a shared memory, the pseudocode for PRAMs is an extension of the pseudocode which is utilized for sequential algorithms. The major new elements are the in parallel statement, the parallelcall statement, and the various opening syntax specifications. To avoid side effects, we will assume that all input parameters (that are not also output parameters) are passed by value. All parameters of a parallel function are assumed to be input parameters. Opening Syntax Specification – PRAM The opening syntax for a procedure written for a PRAM machine has the following form: The opening syntax for a function written for a PRAM machine has the following form: The in parallel Statement Parallel Algorithms III - 1 Parallel Algorithms III (17) procedure <name> (<list of parameters>) model: <model name> with p = (function of n > processors input: <description of input variables> output: <description of output variables> dcl: <declaration of local variables and global variables> function <name> (<list of parameters>) model: <model name> with p = (function of n > processors input: <description of input variables> output: <description of returned value> dcl: <declaration of local variables and global variables>
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
In addition to the usual instructions for serial machines, parallel models have an in parallel statement, which allows operations to be performed on more than one component of the array simultaneously. The general form of the in parallel statement is: for <Boolean expression involving array indices> do in parallel <statement 1> <statement 2> . . . <statement k > end in parallel The for clause is a Boolean expression involving array indices. Only those array elements whose indices satisfy the Boolean expression participate in the instructions contained in the body of the in parallel statement. These instructions can be any statements from sequential algorithms that apply to arrays. Care must be taken however, to ensure that we remain within the confines of SIMD architecture (one of our assumptions). Each of the statements within the in parallel statement are executed simultaneously by a set of active processors. Within the pseudocode, there is no specification for how or which of the processors is active, we simply assume that there are enough processors available to handle the task. However, when we draw the pictures to illustrate the action of the algorithm it is still common to match up processors with operations on array components. Since we have assumed that each processor is as powerful as we need it to be,
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 06/13/2011.

Page1 / 10

para17 - Parallel Algorithms III (17) Parallel Algorithm...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online