24.02.2014 Views

Parallel Processing: A KISS Approach - University of North Dakota

Parallel Processing: A KISS Approach - University of North Dakota

Parallel Processing: A KISS Approach - University of North Dakota

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The algorithm we will use to simulate the heat transfer is a simple 3 element<br />

neighborhood averaging, where each array element becomes the average <strong>of</strong> itself<br />

and its 2 neighbors. Equation (1) depicts the algorithm:<br />

M<br />

1<br />

1<br />

'<br />

i<br />

= ∑ M<br />

( i + x)<br />

3 x=−1<br />

To facilitate the simulation <strong>of</strong> the constant heat and constant cold sources we will<br />

extend array “M” to 14 elements with the outer elements having fixed values. The<br />

constant heat source is colored red and the constant cold source is colored blue:<br />

Heat<br />

Cold<br />

The extended version <strong>of</strong> “M” has array indices <strong>of</strong> 0 to 13 (C/C++) and since the<br />

two end points are points <strong>of</strong> constant value, this extension al lows us to directly<br />

implem ent equation (1) by allowing “i” to range from 1 to 12. We no longer have<br />

to deal with the (original problem’s) end points separately.<br />

Before we partition this into a parallel problem, note that the algorithm is<br />

iterative. A single pass <strong>of</strong> the neighborhood averaging procedure will not produce<br />

correct results. We must apply the neighborhood averaging procedure repeatedly<br />

until convergence occurs (until no significant changes occur from iteration to<br />

iteration).<br />

We will arbitrarily partition the problem space into 3 non-overlapping equal sized<br />

segments and assign each segment to 1 <strong>of</strong> 3 nodes on the cluster:<br />

Node 1 Node 2 Node 3<br />

Heat<br />

Cold<br />

Immediately a problem arises. The calculation involves a neighborhood average,<br />

yet the array elements (shown in gray) along the segment edges do not have all <strong>of</strong><br />

the required neighbors as these “missing” neighbors have been assigned to other<br />

nodes. In order to retain usage <strong>of</strong> our equation and insure identical results to the<br />

sequential version, the necessity for “halo” elements (shown in green) arises:<br />

Node 1 Node 2 Node 3<br />

Heat<br />

Cold<br />

We now have a problem that is uniform across the 3 nodes, in that all local arrays<br />

are <strong>of</strong> the same size (1x6) and whose outer elements have fixed values (at least<br />

with regards to the “local” neighborhood averaging procedure). If this problem<br />

10

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!