Unformatted text preview:

COSC 6374 Parallel Computation 1st homework assignment Edgar Gabriel Fall 2010 Edgar Gabriel 1st Homework Rules Each team should deliver Source code c file Documentation pdf doc tex or txt file explanations to the code answers to questions Deliver electronically to gabriel cs uh edu Expected by Friday October 15 11 59pm In case of questions ask ask ask Parallel Computation Edgar Gabriel 1 Given the sequential code for an image processing algorithm which performs a smoothing operation on an image 1 Parallelize the algorithm using MPI using a 1 D block row wise data distribution each process holds the same number of rows of the image algorithm will require ghostcells need to handle special case for the first and the last process need to add timing functions into the code as well 2 Measure the execution time smoothing operation for 1 2 4 and 8 processors for the 2048x2048 pixel image provided 3 Determine the parallel speedup and the parallel efficiency of the code sequence on the shark cluster for the 2 4 and 8 processor cases Parallel Computation Edgar Gabriel Code consists of three parts reading input image suggestion for parallelization provided later perform smoothing grey erosion your work write output image suggestion for parallelization provided later Algorithm change the class that a pixel has been assigned to if majority of neighboring elements have a different class input file contains for each pixel the integer value of the class that it belongs to result of segmentation clustering for each pixels looks at an area of 5x5 pixels 2 pixels in each direction algorithm performed iteratively 10 times Parallel Computation Edgar Gabriel 2 Parallelization challenge need information from neighboring processes for the Process 0 Process 0 Parallel Computation Edgar Gabriel how to compile the code for measurements gcc o smoothing smoothing c O3 how to compile the code for debugging gcc o smoothing smoothing c g O0 how to run the sequential code smoothing inlabel 1024 bdf outlabel 1024 bdf 1024 1024 Parallel Computation Edgar Gabriel 3 How to read a portion of a matrix Determine the number of rows a process has to read e g localnrows height no of processes used Determine number of ghostcells required in each direction Allocate buffersizes accordingly fpa fopen infile1 rb fseek fpa localheight width sizeof int rank SEEK SET fread labels 0 0 sizeof int localheight width fpa fclose fpa Parallel Computation Edgar Gabriel How to write a portion of the matrix for i 0 i size i if rank i fpa fopen outfile ab fseek fpa localheight width sizeof int rank SEEK SET fwrite labels sizeof int localheight width fpa fclose fpa MPI Barrier MPI COMM WORLD Synchronization between the processes required to ensure that process i 1 has written the data before process i Parallel Computation Edgar Gabriel 4 Documentation The Documentation should contain Brief Problem description Solution strategy Results section Description of resources used Description of measurements performed Results graphs findings Parallel Computation Edgar Gabriel The document should not contain Replication of the entire source code that s why you have to deliver the sources Screen shots of every single measurement you made Actually no screen shots at all The slurm output files Parallel Computation Edgar Gabriel 5 How to use a cluster A cluster usually consists of a front end node and compute nodes You can login to the front end node using ssh from windows or linux machines using the login name and the password assigned to you The front end node is supposed to be there for editing and compiling not for running jobs If 45 students would run their jobs on the same processor everything would stall To allocate a node for interactive development teamxy shark salloc n 4 bash teamxy shark squeue JOBID PARTITION NAME USER ST TIME NODES NODELIST REASON 489 calc smith R 0 02 2 teamxy shark mpirun np 4 mytest shark 08 09 Parallel Computation Edgar Gabriel How to use a cluster II Note the mpirun command will know where to execute the job only if you type the command from the very same terminal window where you typed the salloc command Maximum time an allocation will be available to you 30 minutes after that time your job gets automatically killed by the system fairness rule Note that when you request e g 8 processors you might receive either 4 nodes with 2 cores shark01 24 or 1 nodes with 8 cores shark25 29 Parallel Computation Edgar Gabriel 6 Once your code is correct and you would like to do the measurements You have to submit a batch job The command you need is sbatch e g sbatch n 8 measurements sh Your job goes into a queue and will be executed as soon as a node is available You can check the status of your job with squeue Parallel Computation Edgar Gabriel How to use a cluster III The output of squeue gives you a job id for your job Once your job finishes you will have a file called slurm jobid out in your home directory which contains all the output of your printf statements etc Note the batch script used for the job submission e g measurements sh has to be executable This means that after you downloaded it from the webpage and copied it to shark you have to type chmod x measurements sh Please do not edit the measurements sh file on MS Windows Windows does not add the UNIX EOL markers and this confuses slurm when reading the file Parallel Computation Edgar Gabriel 7 Notes If you need hints on how to use a UNIX Linux machine through ssh http www cs uh edu gabriel cosc4397 s06 ParCo 08 IntroductionUNIX pdf How to use a cluster such as shark http pstl cs uh edu resources html Parallel Computation Edgar Gabriel 8


View Full Document

UH COSC 6374 - COSC 6374 HOMEWORK # 1

Documents in this Course
Load more
Loading Unlocking...
Login

Join to view COSC 6374 HOMEWORK # 1 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view COSC 6374 HOMEWORK # 1 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?