CS计算机代考程序代写 CMDA 3634 SP2021 Introduction to MPI Lab 06

CMDA 3634 SP2021 Introduction to MPI Lab 06
Lab 06: Introduction to MPI
Version: Current as of 2021-03-30 13:01:25 Instructions:
– Written portions of this assignment are submitted via Canvas. Unless specified otherwise, the written portion of the assignment is to be completed using LaTeX. All derivations, images, graphs, and tables are to be included in this document. Handwritten solutions will receive zero credit.
– Code portions of this assignment are submitted via code.vt.edu. Source code must be in the private repository, to which the CMDA 3634 staff must have access.
Deliverables: For this assignment, you are to submit the following:
1. (Canvas) Lab06.pdf: A PDF file, renderd by pdflatex (the file generated by Overleaf is sufficient)
containing the answers to the questions requiring written answers.
2. (code.vt.edu) The source files required to compile and run your solutions to the lab and the tex and image files for your report, in the appropriate directories.
Collaboration: This assignment is to be completed by yourself, however, you make seek assistance from your classmates. In your submission you must indicate who you assisted and from whom you received assistance.
Honor Code: By submitting this assignment, you acknowledge that you have adhered to the Virginia Tech Honor Code and attest to the following:
I have neither given nor received unauthorized assistance on this assignment. The work I am pre- senting is ultimately my own.
Resources
􏰀 MPI:
– Eijkhout book on MPI and OpenMP: http://pages.tacc.utexas.edu/~eijkhout/pcse/html/
index.html
– MPI Quick Reference: http://www.netlib.org/utk/people/JackDongarra/WEB-PAGES/SPRING-2006/ mpi-quick-ref.pdf
Tasks
In this lab, we will practice some basic MPI techniques: printing out a distributed vector in order, and performing an in-place axpy in parallel with two distributed vectors. This lab will focus on correctness of the implementations with point-to-point communications, and future labs will improve on the efficiency and scalability.
1. Setup your coding environment.
(a) In your personal repositories, create the standard directory structure for labs.
(b) Copy the provided materials from the class materials repository to the appropriate place in your personal repository.
1

CMDA 3634 SP2021 Introduction to MPI Lab 06
2. Examine the provided code:
􏰀 The provided routine scatter Vector() partitions a vector into P (almost) equal parts, by processor rank. All ranks get N/P entries, except the last, which also gets the remainder. (This routine is a crude implementation of MPI Scatter.)
3. Implement the following routines using MPI:
(a) distributed print Vector: A function that prints a distributed vector in the correct order.
􏰀 The program test print vector.c tests serial and parallel print routines for vectors. This will help you see that data is distributed correctly.
􏰀 For example, if N = 10, P = 3, and x = [0.1, 3.2, 5.3, −1, 100.3, 383, 4.3, −3.2, −1.9, 2.4], you would expect the printout of the parallel part to be:
Rank 0 has 3 entries 0.10000
3.20000
5.30000
Rank 1 has 3 entries -1.00000
100.300
383.000
Rank 2 has 4 entries 4.30000
-3.20000
-1.90000
2.40000
􏰀 You may need to flush stdout to get things to print in order. Even with this it might not work sometimes. Output buffers are tricky in parallel.
(b) gather Vector: A function that collects a distributed vector back into a single large vector. This is the inverse of scatter Vector and will be a crude implementation of MPI Gather. You may not use MPI Gather. Youy may assume that the input vectors are already allocated.
(c) distributed axpy: A function that performs a distributed axpy by distributing a vector, computing an axpy in-place, and collecting the result.
􏰀 To perform the operation in-place, the vector y is overwritten: y = αx + y
􏰀 A test program, test distributed axpy.c is provided to help you verify that things work.
4. Execute strong and weak scalability studies on TinkerCliffs. Assume that N = 107 for one processor on the strong scaling study, assume that N = 106 for one processor on the weak scaling study, and test for P = 2k for k = 0,1,2,…,8. This will require more than one compute node.
(a) Complete experiment.sbatch, the SLURM submission script for these experiments.
(b) Complete the two provided scripts with appropriate values for the sizes of the vectors to use the
provided timing program time distributed axpy.c to generate your data.
5. Answer the following questions in a LaTeX document.
(a) Explain, in your own words, the communication/data movement pattern in scatter Vector. How did this influence your implementation of gather Vector?
(b) Plot the results of the strong and weak scalability studies. Do you see good strong or weak scalability?
(c) Mathematically, distributed axpy is embarrassingly parallel. Why do we not see ideal speedup in this code?
(d) Other than the instructor or TAs, who did you give assistance to or receive assistance from on this assignment?
6. Submit your results.
2

CMDA 3634 SP2021 Introduction to MPI Lab 06
􏰀 Upload a PDF of your report to Canvas.
􏰀 Push your source code and LaTeX files to code.vt.edu.
􏰀 Examine your assignment repository on code.vt.edu to be sure that all of your materials have been correctly submitted.
3