Ichoran / thyme

Thyme is a microbenchmark utility for Scala. It includes Parsley, a (simple) local profiling tool.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Occasional (stochastic) out of bounds exception

Ichoran opened this issue · comments

May throw an out of bounds error. Example:

$ scala -cp Thyme.jar
Welcome to Scala version 2.10.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_37).
Type in expressions to have them evaluated.
Type :help for more information.

scala> val th = new ichi.bench.Thyme
java.lang.ArrayIndexOutOfBoundsException: -1
    at ichi.maths.package$Distribution$.compute$mDc$sp(package.scala:1600)
    at ichi.bench.Thyme$$anonfun$7.apply$mcDI$sp(Thyme.scala:889)
    at ichi.bench.Thyme$$anonfun$7.apply(Thyme.scala:875)
    at ichi.bench.Thyme$$anonfun$7.apply(Thyme.scala:875)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
    at scala.collection.immutable.Range.foreach(Range.scala:141)
    at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
    at scala.collection.AbstractTraversable.map(Traversable.scala:105)
    at ichi.bench.Thyme.<init>(Thyme.scala:875)
    at .<init>(<console>:7)
    at .<clinit>(<console>)
    at .<init>(<console>:7)
    at .<clinit>(<console>)
    at $print(<console>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:734)
    at scala.tools.nsc.interpreter.IMain$Request.loadAndRun(IMain.scala:983)
    at scala.tools.nsc.interpreter.IMain.loadAndRunReq$1(IMain.scala:573)
    at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:604)
    at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:568)
    at scala.tools.nsc.interpreter.ILoop.reallyInterpret$1(ILoop.scala:745)
    at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:790)
    at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:702)
    at scala.tools.nsc.interpreter.ILoop.processLine$1(ILoop.scala:566)
    at scala.tools.nsc.interpreter.ILoop.innerLoop$1(ILoop.scala:573)
    at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:576)
    at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply$mcZ$sp(ILoop.scala:867)
    at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:822)
    at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:822)
    at scala.tools.nsc.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:135)
    at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:822)
    at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:83)
    at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:96)
    at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:105)
    at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)

Another example:

java.lang.ArrayIndexOutOfBoundsException: -1
    at ichi.maths.package$Distribution$.compute$mDc$sp(package.scala:1600)
    at ichi.bench.Thyme$$anonfun$7.apply$mcDI$sp(Thyme.scala:912)
    at ichi.bench.Thyme$$anonfun$7.apply(Thyme.scala:898)
    at ichi.bench.Thyme$$anonfun$7.apply(Thyme.scala:898)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
    at scala.collection.immutable.Range.foreach(Range.scala:141)
    at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
    at scala.collection.AbstractTraversable.map(Traversable.scala:105)
    at ichi.bench.Thyme.<init>(Thyme.scala:898)
    at ichi.bench.Thyme$$anonfun$37.apply(Thyme.scala:1499)
    at ichi.bench.Thyme$$anonfun$37.apply(Thyme.scala:1499)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
    at scala.collection.immutable.Range.foreach(Range.scala:141)
    at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
    at scala.collection.AbstractTraversable.map(Traversable.scala:105)
    at ichi.bench.Thyme$.warmed(Thyme.scala:1499)
    at TestBitSet$.main(TestBitSet.scala:82)
    at TestBitSet.main(TestBitSet.scala)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at scala.tools.nsc.util.ScalaClassLoader$$anonfun$run$1.apply(ScalaClassLoader.scala:71)
    at scala.tools.nsc.util.ScalaClassLoader$class.asContext(ScalaClassLoader.scala:31)
    at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.asContext(ScalaClassLoader.scala:139)
    at scala.tools.nsc.util.ScalaClassLoader$class.run(ScalaClassLoader.scala:71)
    at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.run(ScalaClassLoader.scala:139)
    at scala.tools.nsc.CommonRunner$class.run(ObjectRunner.scala:28)
    at scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:45)
    at scala.tools.nsc.CommonRunner$class.runAndCatch(ObjectRunner.scala:35)
    at scala.tools.nsc.ObjectRunner$.runAndCatch(ObjectRunner.scala:45)
    at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:74)
    at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:96)
    at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:105)
    at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)

I still have this occasionally, with the jar from the github repo:

$ md5sum Thyme.jar 
abc9fb7e5f1fba301c62f4dc12428585  Thyme.jar
Disconnected from the target VM, address: '127.0.0.1:34433', transport: 'socket'
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1
    at ichi.maths.package$Distribution$.compute$mDc$sp(package.scala:1600)
    at ichi.bench.Thyme$$anonfun$8.apply$mcDI$sp(Thyme.scala:932)
    at ichi.bench.Thyme$$anonfun$8.apply(Thyme.scala:919)
    at ichi.bench.Thyme$$anonfun$8.apply(Thyme.scala:919)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
    at scala.collection.immutable.Range.foreach(Range.scala:166)
    at scala.collection.TraversableLike$class.map(TraversableLike.scala:245)
    at scala.collection.AbstractTraversable.map(Traversable.scala:104)
    at ichi.bench.Thyme.<init>(Thyme.scala:919)
    at ichi.bench.Thyme$.warmed(Thyme.scala:1539)
    at de.dlr.gsoc.mipl.plains.profile.linear.PossibleSchedulingTimesBench$.delayedEndpoint$de$dlr$gsoc$mipl$plains$profile$linear$PossibleSchedulingTimesBench$1(PossibleSchedulingTimesBench.scala:10)
    at de.dlr.gsoc.mipl.plains.profile.linear.PossibleSchedulingTimesBench$delayedInit$body.apply(PossibleSchedulingTimesBench.scala:8)
    at scala.Function0$class.apply$mcV$sp(Function0.scala:40)
    at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
    at scala.App$$anonfun$main$1.apply(App.scala:76)
    at scala.App$$anonfun$main$1.apply(App.scala:76)
    at scala.collection.immutable.List.foreach(List.scala:381)
    at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
    at scala.App$class.main(App.scala:76)
    at de.dlr.gsoc.mipl.plains.profile.linear.PossibleSchedulingTimesBench$.main(PossibleSchedulingTimesBench.scala:8)
    at de.dlr.gsoc.mipl.plains.profile.linear.PossibleSchedulingTimesBench.main(PossibleSchedulingTimesBench.scala)

@rklaehn - Yeah, happens to me too. I wrote a little routine to catch the exception and just try again, since I have found the code pretty impenetrable at least w.r.t. what causes this issue. I need a big chunk of time to fix it. Something is wrong with the logic--there should never be a -1 there as those cases should be dealt with in earlier logic.

Hi, did you resolve it? how?

@Saharitte - I never resolved it; I've been too busy with other things, and the error is deep in some nontrivial mathematical code. See the previous comment for a workaround.

i just resolved it thank you
i used Kmens train(RDD data, int k, int maxIterations, 1, "random") instead of train(RDD data, int k, int maxIterations)

@Saharitte - I'm glad you resolved your problem, but what you wrote above doesn't have anything to do with the code in Thyme.