Github user yanboliang commented on the pull request:
https://github.com/apache/spark/pull/10306#issuecomment-172558579
@mengxr I found the misconfiguration of my test environment and updated it,
thanks!
Now ```gemm``` is about 20-30 times faster than ```axpy/dot``` in the
updated test cases.
```Scala
println(com.github.fommil.netlib.BLAS.getInstance().getClass.getName)
val n = 3000
val count = 10
val random = new Random()
val a = Vectors.dense(Array.fill(n)(random.nextDouble()))
val aa = Array.fill(n)(a)
val b = Vectors.dense(Array.fill(n)(random.nextDouble()))
val bb = Array.fill(n)(b)
val a1 = new DenseMatrix(n, n, aa.flatMap(_.toArray), true)
val b1 = new DenseMatrix(n, n, bb.flatMap(_.toArray), false)
val c1 = Matrices.zeros(n, n).asInstanceOf[DenseMatrix]
var total1 = 0.0
// Trial runs
for (i <- 0 until 10) {
gemm(2.0, a1, b1, 2.0, c1)
}
for (i <- 0 until count) {
val start = System.nanoTime()
gemm(2.0, a1, b1, 2.0, c1)
total1 += (System.nanoTime() - start)/1e9
}
total1 = total1 / count
println("gemm elapsed time: = %.3f".format(total1) + " seconds.")
// Trial runs
for (m <- 0 until 10) {
for (i <- 0 until n; j <- 0 until n) {
dot(bb(j), aa(i))
}
}
var total2 = 0.0
for (m <- 0 until count) {
val start = System.nanoTime()
for (i <- 0 until n; j <- 0 until n) {
// axpy(1.0, bb(j), aa(i))
dot(bb(j), aa(i))
}
total2 += (System.nanoTime() - start)/1e9
}
total2 = total2 / count
println("dot elapsed time: = %.3f".format(total2) + " seconds.")
```
The output is:
```
com.github.fommil.netlib.NativeSystemBLAS
gemm elapsed time: = 1.022 seconds.
dot elapsed time: = 29.017 seconds.
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]