Answer:
You are to write an MPI program to implement the command described here. The program, when given
two command line arguments, the rst of which is a string called the key, and the second of which is the
path name of a text le, searches for all occurrences of the key in the text le. For each position in which
the key occurs, it prints that position as a character oset from the beginning of the le on the
standard output stream. The positions should be printed in ascending order. For example, if the
name of the program is find_matches, then the command
find_matches parallel algorithm ~/cs493.65/lecture_notes
should print every place in the le ~/cs493.65/lecture_notes at which the string parallel algorithm
begins and if that occurs at positions 3, 745, and 930, then the three numbers should appear in the order:
3 then 745 then 930.
If the key contains characters special to the shell, or blanks, it should be enclosed in single quotes or double
quotes, depending on which characters it contains. For example, to search for the key Lincoln is on a $5
bill in the le denominations you would type
find_matches 'Lincoln is on a $5 bill' denominations
or alternatively
find_matches Lincoln is on a \$5 bill denominations
whereas to search for the key Lincoln's on a $5 bill in denominations, you have to enter
find_matches Lincoln\'s on a \$5 bill denominations
A key can not contain embedded newline characters.
Step-by-step explanation:
The first part is your first MPI program, which is not difficult as a parallel algorithm but has technical challenges.