matrices multiplication using mpi · 2020-02-11 · ideas to parallel matrix multiplication: • 1...

18
MPI Special Challenge 3 Matrices multiplication using MPI Cloud Computing | Computer Science and Engineering | WS 2017/18 14.12.2017, 10:00 – 13:15

Upload: others

Post on 02-Mar-2020

12 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Matrices multiplication using MPI · 2020-02-11 · Ideas to Parallel Matrix Multiplication: • 1 single task: Multiplication of 1 row in matrix A to 1 column in matrix B • A x

MPI Special Challenge 3

Matrices multiplication using MPI

Cloud Computing | Computer Science and Engineering | WS 2017/18

14.12.2017, 10:00 – 13:15

Page 2: Matrices multiplication using MPI · 2020-02-11 · Ideas to Parallel Matrix Multiplication: • 1 single task: Multiplication of 1 row in matrix A to 1 column in matrix B • A x

Rodion

Slepnev

Theory and realization of

algorithm

2

Project Team

Minh

Nguyen

Test cases

Karen

Gharslyan

Introduction

and

Coordination

Page 3: Matrices multiplication using MPI · 2020-02-11 · Ideas to Parallel Matrix Multiplication: • 1 single task: Multiplication of 1 row in matrix A to 1 column in matrix B • A x

3

Same program for Master and Worker

Page 4: Matrices multiplication using MPI · 2020-02-11 · Ideas to Parallel Matrix Multiplication: • 1 single task: Multiplication of 1 row in matrix A to 1 column in matrix B • A x

Row on column

4

Matrix Multiplication (1-3)

Page 5: Matrices multiplication using MPI · 2020-02-11 · Ideas to Parallel Matrix Multiplication: • 1 single task: Multiplication of 1 row in matrix A to 1 column in matrix B • A x

5

Matrix Multiplication (2-3)

Rows on column

Page 6: Matrices multiplication using MPI · 2020-02-11 · Ideas to Parallel Matrix Multiplication: • 1 single task: Multiplication of 1 row in matrix A to 1 column in matrix B • A x

Rows on matrix

6

Matrix Multiplication (3-3)

Page 7: Matrices multiplication using MPI · 2020-02-11 · Ideas to Parallel Matrix Multiplication: • 1 single task: Multiplication of 1 row in matrix A to 1 column in matrix B • A x

7

How tasks are assigned to Workers

• Ideas to Parallel Matrix Multiplication:

• 1 single task: Multiplication of 1 row in matrix A to 1 column in matrix B

• A x B with A (a x c) and B (c x b) will have in total a*b tasks

• Simple approach:

• Divide tasks based on number of rows in matrix A

• Rows are divided equally to each workers in cluster

Page 8: Matrices multiplication using MPI · 2020-02-11 · Ideas to Parallel Matrix Multiplication: • 1 single task: Multiplication of 1 row in matrix A to 1 column in matrix B • A x

8

How tasks are assigned to Workers

• Implementation

Page 9: Matrices multiplication using MPI · 2020-02-11 · Ideas to Parallel Matrix Multiplication: • 1 single task: Multiplication of 1 row in matrix A to 1 column in matrix B • A x

9

Send and Receive MPI functions

Page 10: Matrices multiplication using MPI · 2020-02-11 · Ideas to Parallel Matrix Multiplication: • 1 single task: Multiplication of 1 row in matrix A to 1 column in matrix B • A x

10

Test Case

• Matrix A x Matrix B Size matrix A: NRA x 10 Size matrix B: 10 x 10

• Test case varies 3 variables:

• NRA: 10,100,1000,10000,20000,50000,70000,100000

• Number of Nodes: 2,5,7,10,20,30,50,70,100

• MPI Variant: mpich, openmpi

• Execution time and memory consumption of each test case is captured

Page 11: Matrices multiplication using MPI · 2020-02-11 · Ideas to Parallel Matrix Multiplication: • 1 single task: Multiplication of 1 row in matrix A to 1 column in matrix B • A x

11

Execution time (log scaled)

Page 12: Matrices multiplication using MPI · 2020-02-11 · Ideas to Parallel Matrix Multiplication: • 1 single task: Multiplication of 1 row in matrix A to 1 column in matrix B • A x

12

Execution time (log scaled)

Page 13: Matrices multiplication using MPI · 2020-02-11 · Ideas to Parallel Matrix Multiplication: • 1 single task: Multiplication of 1 row in matrix A to 1 column in matrix B • A x

13

Execution time: Small problem size

Page 14: Matrices multiplication using MPI · 2020-02-11 · Ideas to Parallel Matrix Multiplication: • 1 single task: Multiplication of 1 row in matrix A to 1 column in matrix B • A x

14

Execution time: Medium problem size

Page 15: Matrices multiplication using MPI · 2020-02-11 · Ideas to Parallel Matrix Multiplication: • 1 single task: Multiplication of 1 row in matrix A to 1 column in matrix B • A x

15

Memory consumption

Page 16: Matrices multiplication using MPI · 2020-02-11 · Ideas to Parallel Matrix Multiplication: • 1 single task: Multiplication of 1 row in matrix A to 1 column in matrix B • A x

16

Memory consumption

Page 17: Matrices multiplication using MPI · 2020-02-11 · Ideas to Parallel Matrix Multiplication: • 1 single task: Multiplication of 1 row in matrix A to 1 column in matrix B • A x

17

Takeaway

• Same code, different MPI library produces different result

•OpenMPI is faster than mpich in general

•mpich is unexpectedly slow for nodes range: 5~10

-> Results not useful

•Optimal number of nodes for case 20000 x 10, 10 x 10

-> 20 nodes (OpenMPI)

Page 18: Matrices multiplication using MPI · 2020-02-11 · Ideas to Parallel Matrix Multiplication: • 1 single task: Multiplication of 1 row in matrix A to 1 column in matrix B • A x

18

Thank you for listening !