![]() | ![]() | ![]() | Parallel Search Algorithm |
This problem is also taken from PACS (chapter 4.6). The task is to parellize the sequential program "search.f". Please have a look at the sequential program below before considering its parallelization.
The technique which will be used here is "functional decomposition", i.e. a master-and-slave technique: the "master" process takes care of all the i/o operations as well as the organization of the communication; the "slave" processes do the actual work (search). We also suppose that the search results need to be communicated immediately (e.g. because we do not want to waste any memory for storing them); therefore, the search needs to be interrupted by communication each time a slave has found a target value in its local data.
The difficulty here is to find a way by which the "slaves" can communicate to the "master" two different types of information (the search result and the fact that they have finished searching) while the "master" does not know a priori which message comes next and from who.
Another important point to keep in mind is the conversion of local indices to global indices when reporting search results. In future examples this fact will become even more important.
The steps which need to be carried out in the parallel version are the following:
Please write the parallel code and compare its output with the result of running the sequential code below.
This is an example of how the parallel code could look like. It works (taken from chapter 4.6), but is programmed in "bad style". Please take a second to look at it and identify the weak points.
Weaknesses of the above implementation:
markus.uhlmann AT ifh.uka.de
![]() | ![]() | ![]() | Parallel Search Algorithm |