COSC 6374 Parallel Computation HW1: Matrix-Matrix Multiplication & Speedup Analysis - Prof, Assignments of Computer Science

Instructions and guidelines for the first homework assignment in the cosc 6374 parallel computation course. Students are required to implement a parallel matrix-matrix multiplication operation using a 1-d block-column distribution, initialize matrices to random values, and analyze the speedup of their code on different process counts. The document also includes instructions on how to measure execution times and use a cluster for running jobs.

Typology: Assignments

Pre 2010

Uploaded on 08/18/2009

koofers-user-rnh
koofers-user-rnh 🇺🇸

5

(1)

10 documents

1 / 8

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
Edgar Gabriel
COSC 6374
Parallel Computation
1st Homework
Edgar Gabriel
Spring 2009
COSC 6374 –Parallel Computation
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 [email protected]
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
pf3
pf4
pf5
pf8

Partial preview of the text

Download COSC 6374 Parallel Computation HW1: Matrix-Matrix Multiplication & Speedup Analysis - Prof and more Assignments Computer Science in PDF only on Docsity!

Edgar Gabriel

COSC 6374

Parallel Computation

1 st^ Homework

Edgar Gabriel

Spring 2009

COSC 6374 – Parallel ComputationEdgar Gabriel

1 st^ 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 [email protected]
    • 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 ComputationEdgar Gabriel

Part 1

  • Implementing a parallel Matrix-Matrix multiply

operation

  • 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)

C = AB

=

 k

np p

np k

cij aikbkj aikbkj 0

1 0

( / ) 1 0

COSC 6374 – Parallel ComputationEdgar 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 ComputationEdgar Gabriel

Measurements

  • Give the speedup obtained for your code for each

process count using the formula

( ) (^1 )

T p

S p T total

= total

COSC 6374 – Parallel ComputationEdgar Gabriel

How to measure the execution time of

a parallel code

  • 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

double MPI_Wtime (void);

COSC 6374 – Parallel ComputationEdgar Gabriel

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 ComputationEdgar Gabriel

1 st^ 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 ComputationEdgar Gabriel

  • 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 ComputationEdgar 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-.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 ComputationEdgar Gabriel

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