Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-9175

BLAS.gemm fails to update matrix C when alpha==0 and beta!=1

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 1.2.2, 1.3.1, 1.4.1
    • Fix Version/s: 1.2.3, 1.3.2, 1.4.2, 1.5.0
    • Component/s: MLlib
    • Labels:
      None

      Description

      In the BLAS wrapper, gemm is supposed to update matrix C to be alpha * A * B + beta * C. However, the current implementation will not update C as long as alpha == 0. This is incorrect when beta is not equal to 1.

      Example:
      val p = 3
      val a = DenseMatrix.zeros(p,p)
      val b = DenseMatrix.zeros(p,p)
      var c = DenseMatrix.eye(p)
      BLAS.gemm(0, a, b, 5, c)

      c is unchanged in the Spark 1.4 even though it should be multiplied by 5 element-wise.

      The bug is caused by the following in BLAS.gemm:
      if (alpha == 0.0) {
      logDebug("gemm: alpha is equal to 0. Returning C.")
      }

      Will submit PR to fix this.

        Attachments

          Activity

            People

            • Assignee:
              meihuawu Meihua Wu
              Reporter:
              meihuawu Meihua Wu
              Shepherd:
              Xiangrui Meng
            • Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: