Alterna · learning material

10.4. How one cell of a work is calculated

The output cell is the sum of the lines and columns. Repeating this rule fills the entire table.

What this material covers

Content and key concepts

On the previous page, there are many similar actions at the same time.
The output cell is the sum of the lines and columns. Repeating this rule fills the entire table.
The numbers have final accuracy; they have to be stored and moved. The matrix blocks produce a lot of independent work, but memory and group organization also affect the results.
Для изменения рисунка включитеJavaScript; расчёт и теория доступны далее.
Same amount, different order of loading
For A[m,k],B[k,n] each output contains k-productions. Usually, the value is estimated as 2mknFLOPs: Multiplicity and addition are considered two operations, even if one FMA instruction implements them together. The exact number of folds for the sumk of members is k-1, so this is an account agreement, not the number of machine instructions. H04.
In a small example A=[1.2], [3.4]],B=[5.6],[7.8] the result[19.22],][43.50]: The first element:1×5+2x7=19. The capacitor reveals each multiply-accumulate and the time1/2 changes the order of visits to exits and the reuse of entrances.
FMA rounds ab+c once and separate multiply/add after each step. At a =1+2 × 23,c=-(1+2/22) exacta2+c=2\46. A separate FP32 rounding of the work loses this balance and gives 0. H01 gives a binary example; its historical statements of absence of CPU FMA do not apply to modern processors.
Research.
Compare the sum of the Cpritel1 and 2, then the number of modeled input reads. In an ideal little model,1 requires 16 readings of input scalars, tile2–8, writes4 cases. This is not a profiling of the real cache. A large file increases the reuse, but can increase local storage requirements and reduce the numbers of parallel blocks.
A=[[1,2],[3,4]]; B=[[5,6],[7,8]]
C=[[sum(A[i][k]*B[k][j] for k in range(2)) for j in range(2)] for i in range(2)]
assert C==[[19,22],[43,50]]
The code repeats the operations just taken care of.
Completely checked Python-example Chapter
Available with a separate file; the short piece shown does not replace its implementation.
Multiplicity and addition are two arithmetical operations, although the instruction may be the same.
Why is it important to reuse the data? How does this question continue?
Python examples of Chapter 10
Academic base

Textbook contents map