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
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
* We have an infinite loop controlling the */<br />
/* processing, therefore we MUST have some */<br />
/* machanism to terminate the loop!!! */<br />
/* */<br />
/* It is expected that the user will replace */<br />
/* this code with their own. */<br />
/***********************************************/<br />
newSum = SUM_M();<br />
convergence = fabs(newSum - oldSum);<br />
if (verbose == yes) {<br />
printf("Iteration [%d] convergence: %lf.\n", iteration,<br />
convergence);<br />
}<br />
if (convergence < 0.00001 || iteration == 10) break;<br />
oldSum = newSum;<br />
}<br />
// Update iteration counter.<br />
iteration++;<br />
// Write results to log file.<br />
log = fopen("./log", "w");<br />
for (j = 0; j < Height; j++) {<br />
for (i = 0; i < Width; i++) {<br />
fprintf(log, "%6.2lf ", M[j][i]);<br />
}<br />
fprintf(log, "\n");<br />
}<br />
fclose(log);<br />
// Records the stopping time <strong>of</strong> the program.<br />
stopTime = time(NULL);<br />
}<br />
// Display the program's running time.<br />
if (verbose == yes) {<br />
printf("<strong>Processing</strong> time: %d.\n", (stopTime - startTime));<br />
}<br />
/***********************************************************/<br />
/* MAIN. */<br />
/***********************************************************/<br />
/***********************************************/<br />
/* The MAIN routine initializes the system and */<br />
/* starts the processing. */<br />
/* */<br />
/* There is nothing for the user to to change */<br />
/* in this routine. */<br />
/***********************************************/<br />
int main(int argc, char **argv) {<br />
// Process data.<br />
LOAD_BALANCE();<br />
}<br />
// Shut down.<br />
return 1;<br />
30