Levels Tought:
Elementary,Middle School,High School,College,University,PHD
Teaching Since: | Apr 2017 |
Last Sign in: | 10 Weeks Ago, 4 Days Ago |
Questions Answered: | 4870 |
Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Q1) Write an MPI program to multiply two 3x3 matrices (AxB). Use four processors, one processor acts as a master/server. All worker processors will have a copy of Matrix A. The master processor will send one column from matrix B to each processor. Each processor calculates one column of the result matrix and sends it back to the master. The master prints out the result. Use collective communications.
Q2) Write an MPI program to multiply 100x100 matrices (AxB). Use four processors, one acts as a master. The master processor will manage the process of multiplication. It will be waiting for workers to send a ready message. Once the master receives a ready message, it will send one row and one column to be multiplied. Once the worker finishes, it sends the result back to master and asks for another row and column. This continues until the result matrix is calculated. The master then prints the time taken to finish this process. Use collective communications.
Q3) Update questions 2 above such that a copy of matrices A and B are saved in all processors and the master only sends the indices of the row and column to be multiplied. The master reports the time when the process is done.
Q4) Generate an array (5x5) of integers using random numbers. Use 10 processors. Split the processors into two groups, even and odd processors. Distribute the array to both groups. Each processor in the odd group should find the minimum value for one row, the even group the maximum value of one column. Use MPI_Reduce operation to find the minimum and maximum value on one processor and prints them out.
Q5) In sorting problem, sorting algorithm puts the elements of a list in a certain order either ascending or
descending. In this project, you are asked to parallelize some of comparison-based sorting algorithms.
Some comparison-based sorting algorithms perform exchange of adjacent elements repeatedly to
produce the sorted list. On the other hand, some other comparison-based algorithms divide the list into
two sub-lists and sort these sub-lists recursively. This technique is called divide and conquer.
Comparison-based exchange algorithms are usually slower than divide and conquer algorithms.
Examples of exchange algorithms are bubble sort, insertion sort, and selection sort. Popular examples of
divide and conquer algorithms are quick sort and merge sort.
Parallelizing sorting algorithms is not a trivial process due to data dependency. In this project we will try
to parallelize two algorithms (one from each approach) and compare between the performance of the
sequential version and the parallel version of these algorithms. We will try to parallelize selection sort
from exchange category and quick sort from divide and conquer category. The parallelizing of the
algorithms can be done in three main steps. Distribution step, where a master/server process generates
a large random array and distributes it evenly to slave/client processes. Sorting step, where each
slave/client processor sorts its sub-list. Finally, Merge process, where processors exchange their sub-list
in a merge-fashion and send them back to the master/server processor.
Here are the main steps in pseudo code for your parallelizing project.
????????????????????????????????????????????????????????????(????)
1. ???????????????????????? ???????????????????????????? ???????????????????????????????????? ???? ???????????????? ???????? ???? ???????????????????????? ???????????????????????????? ???????????????????????????? 1 ???????????? 1000
2. ???????????????????????? ???????????????????????????? ???????????????????????????? ???????????????????????????? ???????????????? ????1
3. ???????????????????????? ???????????????????????????? ????????????????????????????????/???????????????????????????????????????????? ????â„Ž???? ???????????????? ???????? ???????????? ???????????????????????? ???????????????????????????????????? ????????????????????????
4. ???????????????????? ???????????????????????????????????? ???????????????? ????ℎ???? ???????????? − ???????????????? ???????????????????? ????ℎ???? ???????????????????????????? ????????????????????????????ℎ????
5. ???????? ???????????????????????????????????? ???????? ???????? ????????????????
6. ???????????????? ???????????????? ???????????? − ???????????????? ???????? ???????????????????????????????????? ???????? + 1
7. ???????????????????????????? ???????????? ???????????? − ???????????????? ???????????????? ???????????????????????????????????? ???????? + 1
8. ???????????????????? ???????????? ???????????? − ????????????????????
9. ???????????????????????????? ???????????????? ???????????? − ???????????????? ????????????ℎ ????ℎ???? ???????????????????? ℎ???????????? ???????? ????ℎ???? ???????????????????????? ????????????????
10. ????????????????
11. ???????????????????????????? ???????????????? ???????????? − ???????????????? ???????????????? ???????????????????????????????????? ???????? − 1
12. ???????????????? ???????????? ???????????? − ???????????????? ???????? ???????????????????????????????????? ???????? − 1
13. ???????????????????? ???????????? ???????????? − ????????????????????
14. ???????????????????????????? ???????????? ???????????? − ???????????????? ????????????ℎ ????ℎ???? ???????????????????????? ℎ???????????? ???????? ????ℎ???? ???????????????????????? ????????????????
15. ???????????????????? ???????????????????????????? ???????????????? ????ℎ???????????? ???????????? − ???????????????????? ???????? ???????????????????????? ????????????????????????????
16. ???????????????????????? ???????????????????????????? ???????????????????????????? ???????????????????????????? ???????????????? ????2
17. ???????????????????????? ???????????????????????????? ???????????????????????? ???????????? ????ℎ???? ???????????????????????? ???????????????? ???????????? ???????????????????????????? ????2 − ????1
????????????????????????????????????????????????????????????????????(????)
1. ???????????????????????????????? ???? ???????????????? ???????? ???? ???????????????????????? ???????????????????????????? ???????????????????????????? 1 ???????????? 1000
2. ???????????????????????? ???????????????????????????? ???????????????? ????1
3. ???????????????? ????â„Ž???? ???????????????? ???????????????????? ???????????????????????????? ????????????????????????????â„Ž????
4. ???????????????????????? ???????????????????????????? ???????????????? ????2
5. ???????????????????? ???????????? ????ℎ???? ???????????????????????? ???????????????? ???????????? ???????????????????????? ????ℎ???? ???????????????? ????2 − ????1
Â
Q1) Writean MPI program to multiply two 3x3 matrices (AxB). Use four processors, one processor actsas a master/server. All worker processors will have a copy of Matrix A. The master processor will sendone column from matrix B to each processor. Each processor calculates one column of the result matrixand sends it back to the master. The master prints out the result. Use collective communications.Q2)Write an MPI program to multiply 100x100 matrices (AxB). Use four processors, one acts as amaster. The master processor will manage the process of multiplication. It will be waiting for workers tosend a ready message. Once the master receives a ready message, it will send one row and one columnto be multiplied. Once the worker finishes, it sends the result back to master and asks for another rowand column. This continues until the result matrix is calculated. The master then prints the time taken tofinish this process. Use collective communications.Q3) Updatequestions 2 above such that a copy of matrices A and B are saved in all processors and themaster only sends the indices of the row and column to be multiplied. The master reports the timewhen the process is done.Q4)Generate an array (5x5) of integers using random numbers. Use 10 processors. Split the processorsinto two groups, even and odd processors. Distribute the array to both groups. Each processor in theodd group should find the minimum value for one row, the even group the maximum value of onecolumn. Use MPI_Reduce operation to find the minimum and maximum value on one processor andprints them out.Q5)In sorting problem, sorting algorithm puts the elements of a list in a certain order either ascendingordescending. In this project, you are asked to parallelize some of comparison-based sorting algorithms.Some comparison-based sorting algorithms perform exchange of adjacent elements repeatedly toproduce the sorted list. On the other hand, some other comparison-based algorithms divide the list intotwo sub-lists and sort these sub-lists recursively. This technique is called divide and conquer.Comparison-based exchange algorithms are usually slower than divide and conquer algorithms.Examples of exchange algorithms are bubble sort, insertion sort, and selection sort. Popular examples ofdivide and conquer algorithms are quick sort and merge sort.Parallelizing sorting algorithms is not a trivial process due to data dependency. In this project we will tryto parallelize two algorithms (one from each approach) and compare between the performance of thesequential version and the parallel version of these algorithms. We will try to parallelize selection sortfrom exchange category and quick sort from divide and conquer category. The parallelizing of thealgorithms can be done in three main steps. Distribution step, where a master/server process generatesa large random array and distributes it evenly to slave/client processes. Sorting step, where eachslave/client processor sorts its sub-list. Finally, Merge process, where processors exchange their sub-listin a merge-fashion and send them back to the master/server processor.Here are the main steps in pseudo code for your parallelizing project.°???±±?±²???³?´(?)1.??????µ??¶???´?????????±³????????·?????¸???¸??????1??·10002.??????µ??¶?????¶??·?¶???????³???13.??????µ??¶????¶??????/·³???³¸?????ℎ?±³?????±±?±????³?¶±?·³?´³???±?4.?±???µ??¶??????????ℎ???¸−±³????³?´?ℎ?????³?´?±´??³?ℎ?5.³?µ??¶?????³·³?????6.???·??????¸−±³????µ??¶?????³·+ 1
7.????°???±±???−?°?????²³????????°±+ 18.²??´???????−?°???9.??³?µ?????¶???−?°???°?ℎ?ℎ??°???ℎµ?????ℎ?²??´?±?°??10.????11.????°?????¶???−°°?????²³????????°±−112.??¶±?±±???−?°????³????????°±−113.²??´???????−?°???14.??³?µ???±±???−?°???°?ℎ?ℎ?????¶±ℎµ?????ℎ?²??´?±?°??15.??µ??³????????¶±?ℎ?°????−?°?????²µ????³??????16.²µ????³???????????±??????¶??°²??217.²µ????³????????°???????ℎ????°?±?°??µ¶±??³?????2−?1·?¸??¶?°µ?·???°¶´(¶)1.´?¶??µ??µ?°????¶?µ¶±?²¶?²??????????¶1µ¶±10002.?????±?????¶??°²??13.?????ℎ??°????°¶´????°¶´µ?´??°?ℎ²4.?????±?????¶??°²??25.??°??????ℎ??????±?°??µ¶±??³????ℎ??°²??2−?1
Attachments:-----------