230k views
5 votes
the setup for the program (loading the word ratings and initializing lists) takes 4 minutes. each iteration of the loop takes a different amount of time depending on the book length: condition duration circe 3 minutes educated 3 minutes becoming 6 minutes the handmaid's tale 3 minutes the help 4 minutes malik decides to change the program so that the computer can run each loop iteration in parallel. assuming that he runs the program on a computer that can run 5 tasks in parallel, how long will the parallelized solution take?

User Sabrams
by
6.5k points

2 Answers

2 votes

Final answer:

To run the program in parallel, it will still take a minimum of 6 minutes.

Step-by-step explanation:

To calculate the total time taken for the program to run in parallel, we need to consider the longest duration of an iteration, as the other iterations will finish before that. In this case, the longest duration is 6 minutes for the book 'Becoming'. So, the program will take a minimum of 6 minutes to complete all iterations in parallel.

Since the computer can run 5 tasks in parallel, the first 5 iterations will start simultaneously and will finish in a maximum of 6 minutes. The remaining iterations will start one after the other as previous iterations complete in parallel or finish. Therefore, the parallelized solution will still take 6 minutes to complete.

Therefore, the parallelized solution will take a minimum of 6 minutes to complete.

User Umm
by
7.6k points
2 votes

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.

User Sdrevk
by
7.4k points