Content

GEMV: Blockweise Berechnung mit Fused-Vector-Operations

In der Vorlesung haben wir uns überlegt, dass es vorteilhaft sein könnte bei der GEMV Operatione mehr als nur eine Zeile oder Spalte von \(A\) in den Cache zu laden und mit \(x\) oder Komponenten von \(x\) zu multiplizieren. Dabei betrachten wir für die Operation folgende Partitionierungen von \(A\):

Algorithmus für GEMV

Mit den obigen Überlegungen leitet man sich folgenden Algorithmus her:

  • \(y \leftarrow \beta\, y\)

  • \(\text{If}\; \text{incRow}_\text{A} > \text{incCol}_\text{A}\)

    • \(\text{Consider row-wise quasi-equidistant partitions with respect to}\;f:\)

      • \[A = \begin{pmatrix}\mathbf{A}_1 \\\hline\mathbf{A}_2 \\\hline\vdots \\\hline\mathbf{A}_{m_b}\end{pmatrix}, \quad y = \begin{pmatrix}\mathbf{y}_1 \\\hline\mathbf{y}_2 \\\hline\vdots \\\hline\mathbf{y}_{m_b}\end{pmatrix}, \quad m_b = \left\lceil \frac{m}{f} \right\rceil\]
    • \(\text{For}\; i=1,\dots,m_b\)

      • \( \mathbf{y}_i \leftarrow \mathbf{y}_i + \alpha\, \mathbf{A}_i x \)

  • \(\text{Else}\)

    • \(\text{Consider col-wise quasi-equidistant partitions with respect to}\;f:\)

      • \[A = \left(\begin{array}{c|c|c|c}\mathbf{A}_1 &\mathbf{A}_2 &\dots &\mathbf{A}_{n_b}\end{array}\right), \quad x = \left(\begin{array}{c}\mathbf{x}_1 \\\mathbf{x}_2 \\\vdots \\\mathbf{x}_{n_b}\end{array}\right), \quad n_b = \left\lceil \frac{n}{f} \right\rceil\]
    • \(\text{For}\; j=1,\dots,n_b\)

      • \( y \leftarrow y + \alpha\, \mathbf{A}_{j} \mathbf{x}_j \)

Aufgaben