Professional Documents
Culture Documents
SIMD and MIMD
SIMD and MIMD
Handout_11
1. SIMD Programming
Below is presented a matrix multiply pseudocode for an SIMD computer. This assumes that
calculation of one column of product matrix is assigned to one PE. That is, for N x N product
matrix, we require N PEs.
N
/* Matrix multiply, C: = A.B. Compute elements of C by cij = ∑ aik bkj */
k =1
For parallel algorithms, it’s also important to consider the data access requirements i.e. the data
layout in memory of the machine. For instance, this SIMD algorithm requires that PEk must have
access to kth-column of matrix B while access of whole matrix A is required by every PE.
2. MIMD Programming
Below is presented a matrix multiply pseudocode for a MIMD computer (Multiprocessor).
private i, j, k;
shared A[N,N], B[N,N], C[N,N], N;
/* The original process reaches this point and does the processing for Nth column */
j := N;
Of particular importance is the join command here. It has an implicit counter associated with it
that starts off at a count = 0. This counter is shared by all processes (processors) executing the
code. A process executing join increments this counter and compares it to N, the argument to
join. If the value of count is not N, then this process kills itself. The process finding this count
to be N, continues execution beyond join command. This way only one process continues
beyond join and all other processes get terminated.
*****
Page - 2 - of 2