Unformatted text preview:

COSC 6374 Parallel Computation 1st Homework Edgar Gabriel Spring 2009 Edgar Gabriel 1st Assignment Rules Each student should deliver Source code c h and Makefiles files Please no o files and no executables Documentation pdf doc tex or txt file Deliver electronically to gabriel cs uh edu Expected by Wednesday February 25 11 59pm In case of questions ask the TAs first if he doesn t know the answer he will ask me Ask early not the day before the submission is due COSC 6374 Parallel Computation Edgar Gabriel 1 Part 1 Implementing a parallel Matrix Matrix multiply operation C AB 1 D block column distribution of all matrices Based on shifting the local portion of A from one process to the next see next slides np 1 np 1 cij aik bkj k 0 a p 0 b ik kj k 0 COSC 6374 Parallel Computation Edgar Gabriel Part 1 Initialize the matrix C to zero Initialize the matrices A and B to random values between 1 and 10 Matrices shall be double precision floating point values In every iteration a process calculates the partial result of the Matrix Matrix multiply sends the current portion of the Matrix A to its right neighbor receives the next portion of the Matrix A from its left neighbor COSC 6374 Parallel Computation Edgar Gabriel 2 rank 0 1 2 n 1 0 1 n 1 x 01 2 A 2 01 2 n 1 2 n 1 0 1 n 1 A C 0 1 n 2 x 2 01 2 n 1 2 1 2 3 n 1 A x n 1 C 0 1 0 0 1 2 n 1 0 1 2 n 1 it 1 B rank 0 1 n 1 n 1 0 1 2 n 1 it 0 B rank 0 1 0 1 2 2 01 2 B n 1 0 1 2 n 1 n 1 0 1 2 n 1 it np 1 C COSC 6374 Parallel Computation Edgar Gabriel Part 2 Speedup analysis for a global Matrices of size 1600x1600 determine the execution time of your code on 1 2 4 and 8 processes i e for 1 for 2 for 4 for 8 proc local matrix size is 1600x1600 procs local matrix size is 1600x800 procs local matrix size is 1600x400 procs local matrix size is 1600x200 each measurement shall be repeated three times and the average value shall be used COSC 6374 Parallel Computation Edgar Gabriel 3 Measurements Give the speedup obtained for your code for each process count using the formula S p Ttotal 1 Ttotal p COSC 6374 Parallel Computation Edgar Gabriel How to measure the execution time of a parallel code double MPI Wtime void MPI Wtime returns a floating point number of seconds representing elapsed wall clock time since some time in the past The times returned are local to the process that called them There is no requirement that different processes return the same time After each process determined its own execution time determine the maximum execution time across all processes e g using MPI Allreduce using the MPI MAX operator COSC 6374 Parallel Computation Edgar Gabriel 4 The Documentation The Documentation should give somebody enough information to repeat your measurements and confirm your findings It should contain Brief Problem description Solution strategy Results section Description of compute resources used Description of measurements performed Results graphs findings COSC 6374 Parallel Computation Edgar Gabriel 1st Assignment 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 COSC 6374 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 41 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 COSC 6374 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 you an allocation will be available 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 node with 8 cores shark25 29 COSC 6374 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 sqeueu COSC 6374 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 COSC 6374 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 COSC 6374 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?