CSC 4005 Distributed and Parallel Computing Prof YehChing
CSC 4005 – Distributed and Parallel Computing Prof. Yeh-Ching Chung School of Data Science Chinese University of Hong Kong, Shenzhen 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 1
Outline l l l l l Introduction to Parallel Computers Message Passing Computing and Programming Multithreaded Programming Open. MP Programming Embarrassingly Parallel Computations Partitioning and Divide-and-Conquer Strategies Pipelined Computations Synchronous Computations Load Balancing and Termination Detection Sorting Algorithms 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 2
Message-Passing Computing 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 3
Goals 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 4
Single Program Multiple Data (SPMD) Model 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 5
Multiple Program Multiple Data (MPMD) Model 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 6
Basic Send and Receive Routines 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 7
Synchronous Message Passing (1) 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 8
Synchronous Message Passing (2) 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 9
Blocking and Nonblocking Message Passing 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 10
MPI Definitions pf Blocking and Nonblocking 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 11
How Message-Passing Routines Can Return Before the Message Transfer Has Been Completed 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 12
Message Tag 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 13
Broadcast 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 14
Scatter 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 15
Gather 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 16
Reduce 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 17
Using Workstation Clusters – Software Tools 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 18
PVM (1) 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 19
PVM (2) 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 20
PVM (3) 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 21
Basic Message-Passing Routines (1) 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 22
Basic Message-Passing Routines (2) 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 23
Sending Data Composed of Various Types 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 24
Broadcast, Multicast, Scatter, Gather, and Reduce 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 25
Example - PVM Program (1) 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 26
Example - PVM Program (2) 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 27
MPI 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 28
Using the SPMD Computational Model 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 29
Global and Local Variables 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 30
Unsafe Message Passing with Library 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 31
MPI Solution 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 32
Communication Types 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 33
Point-to-Point Communication 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 34
MPI Blocking Send and Receive 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 35
Example 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 36
Nonblocking Routines 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 37
Example 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 38
Send Communication Modes 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 39
Collective Communication 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 40
Example 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 41
Barrier 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 42
Example 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 43
Pseudocode Constructs 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 44
Time Complexity of MPI Program 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 45
Communication Time 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 46
Important Note on Interpretation of Equations 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 47
Latency Hidden 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 48
Time Complexity (1) 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 49
Time Complexity (2) 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 50
Time Complexity (3) 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 51
Example 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 52
Time Complexity of a Parallel Algorithm 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 53
Cost Optimal Algorithms 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 54
Time Complexity of Broadcast (1) 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 55
Time Complexity of Broadcast (2) 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 56
Time Complexity of Broadcast (3) 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 57
Time Complexity of Broadcast (4) 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 58
Broadcast on a Workstation Cluster 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 59
1 -to-N Fan-Out Broadcast 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 60
1 -to-N Fan-Out Broadcast on a Tree 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 61
Gather on a Hypercube Network 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 62
Debugging and Evaluating Parallel Programs 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 63
Debugging Strategies 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 64
Evaluating Programs Empirically 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 65
Communication Time by the Ping-Pong Method 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 66
Profiling 香港中文大学(深圳)数据科学院 CUHK-SZ School of Data Science National Tsing Hua University ® copyright OIA 67
- Slides: 67