next up previous
Next: Master-Slave Matrix Multiply Up: Experimental Results Previous: Experimental Results

Master-Slave Array Operations

=

 
		float data[ARRAYSIZE];

float result[ARRAYSIZE];

xx¯ Master:

xxxxxxxx¯ initialize data array;

xxxxxxxx¯ foreach worker

xxxxxxxxxx¯ send equal share of data array;

xxxxxxxx¯ foreach worker

xxxxxxxxxx¯ receive into result array;

xxxxxxxx¯ display results;

xx¯ Slave:

xxxxxxxx¯ receive my portion of data array

xxxxxxxx¯ perform simple calc on data

xxxxxxxx¯ send back results

  
Figure 4: Master-Slave Array Operation Application

This is master-slave style program that performs a simple operation on a one dimensional array. The master first distributes equal portions of the array to each worker. When the worker tasks receive the array portion, is does a simple computation to determine the resulting value for all the elements in its portion. Upon completion, each worker task sends its portion back to the master, and exits. The master collects all the portions from the workers until the operation is finished, then exits. This application has a well defined communication phase and computation phase structure that makes measurements easier. The pseudo-code for this application is given in Figure 4. The communication times are presented in Table 1.

  
Table 1: Communication performance of distributed array operation



Generated by latex2html-95.1
Thu Jun 1 21:05:27 EDT 1995