这是一篇来自澳洲的关于MPI Programming Assignment and Analysis(MPI编程分配与分析)的计算机代写,基本要求是要在MPI中实现分布式并行程序,请使用集体通信来分发问题和积累答案,并使用点对点通信来实现二叉树。最后,来评估和讨论解决方案的并行缩放问题。
- Assignment guidance
Implement an MPI program that reads in an image fifile and outputs a histogram of the number of pixels with each grey scale value. Constructing the histogram should use multiple processes. The image fifiles are in uncompressed .pgm (portable greymap) format, in which each pixel takes a single integer value corresponding to its greyscale value, with 0 for black and some value maxValue for white. The image dimensions and maxValue are provided in the fifirst few lines of the image fifile1.
- Assessment tasks
You are provided with code that reads in the image fifile and constructs the histogram in serial. You need to adapt the code so that it constructs the histogram in parallel using MPI. For the fifirst part of this assignment, you should use collective communication routines wherever possible, including distributing the necessary global parameters (i.e. the number of image pixels per process, and maxValue) to all processes.
Once you have this working, you should then implement an alternative implementation for the distribution of global parameters that uses point-to-point communication in a binary tree pattern. This alternative should be automatically called if the number of processes numProcs is a power of 2; if it is not a power of 2, your code should continue to use your original version. Your submitted code should therefore include two versions of the distribution of global parameters, each being called depending on the number of processes specifified when launching with mpiexec.
Once you have the fifinal version of your code, perform timing runs, on either a School machine or your own, to determine the parallel execution time as the number of processes is varied (the provided code already outputs this time). The combination of numbers of processes and nodes is given in the fifile readme.txt, and you should insert your results and discussion into this fifile, and include it when submitting. You should also interpret your results in terms of your understanding of MPI and the architecture you used for these timing runs.
You have been provided with code that reads in the image fifile to a data array on rank 0, with additional padding values of -1 so that the total array size is a multiple of the number of processes (this is a common way of handling data sets of arbitrary size). An example of how to construct the histogram in serial is also included.
The provided fifiles are:
cwk2.c : Starting point for your solution.
readme.txt : Use to provide results of your timing runs, and interpretation.
cwk2 extras.h : Routines to load the image and save the histogram. Do not modify this fifile; it will be replaced with a difffferent version for assessment.
image.pgm : An image to test your code on.
makefile : A simple makefifile (usage optional).
plotHistogram.py : Plots the histogram fifile (usage optional). To use: python plotHistogram.py (assumes in same directory as the output fifile hist.out; expects Python 3).
- General guidance and study support
If you have any queries about this coursework, visit the Teams page for this module. If your query is not resolved by previous answers, post a new message. Support will also be available during the timetable lab sessions.
It is recommended that you proceed incrementally, testing your code after each stage of your calculations. For the binary tree, you may fifind it useful to insert print statements showing which rank each process is sending to or receiving from, to ensure that allsends have corresponding receives.
Collective communication was covered in Lecture 10 and reduction in Lecture 11. Forthe binary tree, you may like to consider an upside-down version of the second binarytree considered in Lecture 11, as it is easier to code. Think carefully about which ranks send data, and which receive, at each level of the tree. You may fifind the following useful:
1<<n : Evaluates as 2n.
if( n && ((n&(n-1))==0) ) : Evaluates as true if n is a power of 2.
int lev=1; while(1<<lev<=p)lev++; : Finds the number of levels lev in a binary tree with p leaf nodes.
- Assessment criteria and marking process
Your code will be checked using an autograder on Gradescope to test for functionality.
Staffff will then inspect your code the allocate the marks as per the mark scheme (see below).
- Submission requirements
Submission is via Gradescope.
If you have only edited cwk2.c and readme.txt, submit both of these fifiles only.
If you have added extra code fifiles, ensure they are all in a flflat directory (i.e. do not use subdirectories) and that the makefifile has been suitably amended according to the instructions it contains.
Do not modify cwk2 extras.h, or copy any of the content to another fifile and then modify. This fifile will be replaced with a difffferent version as part of the assessment, so it is imperative that your code still calls these routines.
You should fifirst submit your solution to Coursework 2: Check submission. This will run some checks to make sure your solution runs on the test system, and immediately report back any problems. Only after you have passed all tests should you submit your solution to Coursework 2: Final Submission for assessment. Your timing runs should be performed either on a School machine or one of your own, prior to submitting to Gradescope.
- Academic misconduct and plagiarism
Academic integrity means engaging in good academic practice. This involves essential academic skills, such as keeping track of where you fifind ideas and information and referencing these accurately in your work.
By submitting this assignment you are confifirming that the work is a true expression of your own work and ideas and that you have given credit to others where their work has contributed to yours.
Code similarity tools will be used to check for collusion, and online source code sites will be checked.
- Assessment/marking criteria
There are 20 marks in total:
4 marks : Histogram calculated and output correctly.
7 marks : Parallel calculation of histogram without the binary tree.
6 marks : Binary tree distribution of global parameters.
3 marks : Speed-up calculations and interpretation.
Note that you can achieve a fifirst class mark without implementing the binary tree, in which case your code should use collective communication for the distribution of the global parameters for any number of processes.
程序代写代做C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB

本网站支持淘宝 支付宝 微信支付 paypal等等交易。如果不放心可以用淘宝交易!
E-mail: itcsdx@outlook.com 微信:itcsdx
如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。
