MPI Lab09: Parallel Programming Application 1: Array Search

Assignment
Implements a parallel search of an extremely large (several thousand elements) integer array. The program finds all occurrences of a certain integer, called the target, and writes all the array indices where the target was found to an output file. The program can read the target value and all the array elements from an input file. Or the program can read in the target value and can assign the values into the array at runtime.

FIRST PART:

Before writing a parallel version of a program, familiarize yourself with this example searchvalue.c serial version (that is, a version that runs on one processor without MPI). You can use either Fortran or C to write your own version, or you can use this version. Confirm that the program works by test runs with various input arrays.

Use this file nums.txt for the values. The first number in the file is the target value.

SECOND PART:

Write the parallel code to accomplish the same task.

randoms2.c This uses srand(7) to generate the same sequence of values into the array. See if you get this same sequence.

array2MPI.c provides an example of sending an array to all processes and each process finding the sum of only their portion of the array.