Chapter 6: Q11E (page 570)
We would like to execute the loop below as efficiently as possible. We have two different machines, a MIMD machine and a SIMD machine.
for (i=0;i<2000;i++)
for(j=0;j<3000;j++)
X_array[i][j] = Y_array[j][i] + 200;
6.11.1 [10] For a 4 CPU MIMD machine, show the sequence of MIPS instructions that you would execute on each CPU. What is the speedup for this MIMD machine?
6.11.2 [10] For an 8-wide SIMD machine (i.e.,8 parallel SIMD functional units), write an assembly program in using your own SIMD extensions to MIPS to execute the loop. Compare the number of instructions executed on the SIMD machine to MIMD machine.
Short Answer
(6.11.1)–
for i := 0 step 1 until 2000
begin
for j := 0 step 1 until 3000
for ADD;
ADD:
X_array[i][j]:=Y_array[j][i]+200;
join;
end;
(6.11.2)
for j := 0 step 1 until 3000
begin
X_array[i][j] := Y_array[j][i] + 200, (0<i<2000);
end;