You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed SVD decomposition retuns wrong results when
invoking this method concurrently on the multithreaded environment:
fails on: com.github.fommil.netlib.NativeRefLAPACK (netlib-native_ref-win-x86_64.dll)
fails on: com.github.fommil.netlib.NativeSystemLAPACK (netlib-native_system-win-x86_64.dll)
success on: com.github.fommil.netlib.NativeSystemLAPACK (netlib-native_system-linux-x86_64.so)
success on: com.github.fommil.netlib.F2jLAPACK
Not sure if this is matter of glue code or LAPACK itself. Wrapping SVD method invocation
in the synchronization block helps (produces same results as when running single-threaded).
I noticedthat this issue affects only left/right vectors,
singular values seem to be fine.
Please take a look at sample code below:
object BreezeMultiThreading extends App {
implicit val ec: ExecutionContextExecutor = scala.concurrent.ExecutionContext.global
val x = Seq.tabulate(1000) { i =>
Future /*.successful*/ { // uncomment to run single-threaded
println(s"Iteration $i")
val rnd = new scala.util.Random(12345 + i)
val input = DenseMatrix.tabulate[Double](100, 100)((_,_) => rnd.nextDouble())
val svdec = svd(input)
// val sum = svdec.singularValues.valuesIterator.sum
val sum = svdec.leftVectors.valuesIterator.sum + svdec.rightVectors.valuesIterator.sum
sum
}
}
val sum = Await.result(Future.sequence(x).map(_.sum), Duration.Inf)
// val exp = 291367.83234463 // singular values
val exp = -19997.446618756203 // left/right vectors
if (abs(sum - exp) < 0.00001)
Console.out.println(s"Success: $sum")
else
Console.err.println(s"Failed: $sum, expected: $exp")
}
marcin
The text was updated successfully, but these errors were encountered:
sorry for being slow. it's suspicious to me this only happens on windows so i doubt it's the glue code. I can add a lock if we're running on windows, i guess?
Hi
I noticed SVD decomposition retuns wrong results when
invoking this method concurrently on the multithreaded environment:
Not sure if this is matter of glue code or LAPACK itself. Wrapping SVD method invocation
in the synchronization block helps (produces same results as when running single-threaded).
I noticedthat this issue affects only left/right vectors,
singular values seem to be fine.
Please take a look at sample code below:
marcin
The text was updated successfully, but these errors were encountered: