performance measurements

Each table row shows performance measurements for this Scala program with a particular command-line input value N.

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
500Failed  720   

Read the ↓ make, command line, and program output logs to see how this program was run.

Read spectral-norm benchmark to see what this program should do.

 notes

java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

Scala compiler version 2.11.4 -- Copyright 2002-2013, LAMP/EPFL

 spectral-norm Scala #2 program source code

/* The Computer Language Benchmarks Game

   http://benchmarksgame.alioth.debian.org/

   contributed by Eric Willigers

   based on Java version by The Anh Tran

*/

object spectralnorm {
   val nthread = Runtime.getRuntime.availableProcessors
   val barrier = new java.util.concurrent.CyclicBarrier(nthread)

   def main(args: Array[String]) {
      val n = if (args.length > 0) Integer parseInt args(0)  else 1000
      val fmt = new java.text.DecimalFormat("#.000000000")
      println(fmt format run(n))
   }

   def run(n: Int) = {
      val u = new Array[Double](n)
      val v = new Array[Double](n)
      val tmp = new Array[Double](n)
      val chunk = n / nthread
      var vBv = 0.
      var vv = 0.
      java.util.Arrays.fill(u, 1.)
      Array range(0, nthread) map { i =>
         val rbegin = i * chunk
         val rend = if (i < (nthread -1)) rbegin + chunk else n
         new Approximate(u, v, tmp, rbegin, rend)         
      } foreach { a=>
         a join()
         vBv += a.m_vBv
         vv += a.m_vv
      }
      Math sqrt(vBv/vv)
   }

   final class Approximate(u: Array[Double], v: Array[Double], tmp: Array[Double], rbegin: Int, rend: Int) extends Thread {
      var m_vBv = 0.
      var m_vv = 0.
      start()

      override def run() {
         for (i <- 0 until 10) {
            MultiplyAtAv(u, tmp, v)
            MultiplyAtAv(v, tmp, u)            
         }
         for (i <- rbegin until rend) {
            m_vBv += u(i) * v(i)
            m_vv  += v(i) * v(i)
         }
      }

      @inline
      def eval_A(i: Int, j: Int) = 1.0 / ( ((i+j) * (i+j+1) >>> 1) +i+1 )

      def MultiplyAv(v: Array[Double], Av: Array[Double]) {
         for (i <- rbegin until rend) {
            var sum = 0.
            var j = 0
            while (j < v.length) {
               sum += eval_A(i, j) * v(j)
               j += 1
            }
            Av(i) = sum
         }
      }

      def MultiplyAtv(v: Array[Double], Atv: Array[Double]) {
         for (i <- rbegin until rend) {
            var sum = 0.
            var j = 0
            while (j < v.length) {
               sum += eval_A(j, i) * v(j)
               j += 1
            }
            Atv(i) = sum
         }
      }

      def MultiplyAtAv(v: Array[Double], tmp: Array[Double], AtAv: Array[Double]) {
         MultiplyAv(v, tmp)
         barrier await()
         MultiplyAtv(tmp, AtAv)
         barrier await()
      }
   }
}

 make, command-line, and program output logs

Wed, 19 Nov 2014 01:04:11 GMT

MAKE:
mv spectralnorm.scala-2.scala spectralnorm.scala
/usr/local/src/scala-2.11.4/bin/scalac -optimise -target:jvm-1.8 spectralnorm.scala
spectralnorm.scala:23: error: identifier expected but 'var' found.
      var vv = 0.
      ^
spectralnorm.scala:39: error: identifier expected but 'var' found.
      var m_vv = 0.
      ^
spectralnorm.scala:59: error: identifier expected but 'var' found.
            var j = 0
            ^
spectralnorm.scala:71: error: identifier expected but 'var' found.
            var j = 0
            ^
four errors found
make: [spectralnorm.scala-2.scala_run] Error 1 (ignored)
1.35s to complete and log all make actions

COMMAND LINE:
 /usr/local/src/jdk1.8.0_25/bin/java -server -XX:+TieredCompilation -XX:+AggressiveOpts  -Xbootclasspath/a:/usr/local/src/scala-2.11.4/lib/scala-library.jar:/usr/local/src/scala-2.11.4/lib/akka-actors.jar:/usr/local/src/scala-2.11.4/lib/typesafe-config.jar spectralnorm 500

PROGRAM FAILED 


PROGRAM OUTPUT:

Error: Could not find or load main class spectralnorm

Revised BSD license

  Home   Conclusions   License   Play