luhenry commented on a change in pull request #32124:
URL: https://github.com/apache/spark/pull/32124#discussion_r619784605



##########
File path: 
mllib/src/main/scala/org/apache/spark/ml/classification/LogisticRegression.scala
##########
@@ -982,14 +982,14 @@ class LogisticRegression @Since("1.2.0") (
         val adapt = Array.ofDim[Double](numClasses)
         BLAS.javaBLAS.dgemv("N", numClasses, numFeatures, 1.0,
           initialSolution, numClasses, scaledMean, 1, 0.0, adapt, 1)
-        BLAS.getBLAS(numFeatures).daxpy(numClasses, 1.0, adapt, 0, 1,
+        BLAS.javaBLAS.daxpy(numClasses, 1.0, adapt, 0, 1,
           initialSolution, numClasses * numFeatures, 1)
       } else {
-        // orginal `initialCoefWithInterceptArray` is for problem:
+        // original `initialSolution` is for problem:
         // y = f(w1 * x1 / std_x1, w2 * x2 / std_x2, ..., intercept)
         // we should adjust it to the initial solution for problem:
         // y = f(w1 * (x1 - avg_x1) / std_x1, w2 * (x2 - avg_x2) / std_x2, 
..., intercept)
-        val adapt = BLAS.getBLAS(numFeatures).ddot(numFeatures, 
initialSolution, 1, scaledMean, 1)
+        val adapt = BLAS.javaBLAS.ddot(numFeatures, initialSolution, 1, 
scaledMean, 1)

Review comment:
       `javaBLAS` is faster than `nativeBLAS` from local experiment for all 
level-1 and level-2 operations. The cost of copying from java heap to native 
memory is too great for these operations, and is only amortized for level-3 
operations. So switching to `javaBLAS` here for `ddot` makes sense to me.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to