/mobile Handheld Friendly website
Ubuntu : Intel® Q6600® one core |
Each table row shows performance measurements for this F# Mono program with a particular command-line input value N.
| N | CPU secs | Elapsed secs | Memory KB | Code B | ≈ CPU Load |
|---|---|---|---|---|---|
| 500 | 0.62 | 2.04 | 16,424 | 852 | 1% 0% 0% 32% |
| 3,000 | 9.12 | 10.35 | 16,424 | 852 | 0% 0% 0% 88% |
| 5,500 | 29.74 | 30.58 | 16,428 | 852 | 0% 0% 0% 97% |
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.
Microsoft (R) F# 3.0 Compiler version (Mono build)
Mono JIT compiler version 3.0.3 (tarball Tue Feb 12 10:56:44 PST 2013)
LLVM: yes(3.2svn-mono)
// The Computer Language Benchmarks Game // http://benchmarksgame.alioth.debian.org/ // // Based on C# version by Isaac Gouy, The Anh Tran, Alan McGovern // Contributed by Don Syme open System open System.Threading type BarrierHandle(threads:int) = let mutable current = threads let mutable handle = new ManualResetEvent(false) member x.WaitOne() = let h = handle if Interlocked.Decrement(¤t) > 0 then h.WaitOne() |> ignore; else handle <- new ManualResetEvent(false); Interlocked.Exchange(¤t, threads) |> ignore; h.Set() |> ignore; h.Close(); let Approximate(u:double[], v:double[], tmp:double[], rbegin, rend, barrier: BarrierHandle) = let mutable vBv = 0.0 let mutable vv = 0.0 // return element i,j of infinite matrix A let A i j = 1.0 / float((i + j) * (i + j + 1) / 2 + i + 1) // multiply vector v by matrix A let multiplyAv(v:double[], Av:double[]) = for i = rbegin to rend - 1 do let mutable sum = 0.0; for j = 0 to v.Length - 1 do sum <- sum + A i j * v.[j]; Av.[i] <- sum // multiply vector v by matrix A transposed let multiplyAtv(v:double[], atv:double[]) = for i = rbegin to rend - 1 do let mutable sum = 0.0 for j = 0 to v.Length - 1 do sum <- sum + A j i * v.[j]; atv.[i] <- sum; // multiply vector v by matrix A and then by matrix A transposed let multiplyatAv(v:double[], tmp:double[], atAv:double[]) = multiplyAv(v, tmp); barrier.WaitOne(); multiplyAtv(tmp, atAv); barrier.WaitOne(); for i = 0 to 9 do multiplyatAv(u, tmp, v); multiplyatAv(v, tmp, u); for i = rbegin to rend - 1 do vBv <- vBv + u.[i] * v.[i]; vv <- vv + v.[i] * v.[i]; (vBv, vv) let RunGame n = // create unit vector let u = Array.create n 1.0 let tmp = Array.zeroCreate n let v = Array.zeroCreate n let nthread = Environment.ProcessorCount; let barrier = new BarrierHandle(nthread); // create thread and hand out tasks let chunk = n / nthread; // objects contain result of each thread let aps = Async.Parallel [ for i in 0 .. nthread - 1 do let r1 = i * chunk; let r2 = if (i < (nthread - 1)) then r1 + chunk else n yield async { return Approximate(u, v, tmp, r1, r2, barrier) } ] |> Async.RunSynchronously let vBv = aps |> Array.sumBy fst let vv = aps |> Array.sumBy snd Math.Sqrt(vBv / vv); [<EntryPoint>] let main args = let n = try int <| args.[0] with _ -> 2500 System.Console.WriteLine("{0:f9}", RunGame n); 0
Wed, 13 Feb 2013 03:27:03 GMT MAKE: mv spectralnorm.fsharp-2.fsharp spectralnorm.fsharp-2.fs /usr/local/bin/fsharpc --target:exe --platform:x86 -O -o spectralnorm.fsharp-2.fsharp_run.exe spectralnorm.fsharp-2.fs Microsoft (R) F# 3.0 Compiler version (Mono build) Copyright (c) Microsoft Corporation. All Rights Reserved. /home/dunham/benchmarksgame_onecore/spectralnorm/tmp/spectralnorm.fsharp-2.fs(7,1): warning FS0221: The declarations in this file will be placed in an implicit module 'Spectralnorm.fsharp-2' based on the file name 'spectralnorm.fsharp-2.fs'. However this is not a valid F# identifier, so the contents will not be accessible from other files. Consider renaming the file or adding a 'module' or 'namespace' declaration at the top of the file. rm spectralnorm.fsharp-2.fs 4.40s to complete and log all make actions COMMAND LINE: /usr/local/bin/mono --llvm spectralnorm.fsharp-2.fsharp_run.exe 5500 PROGRAM OUTPUT: 1.274224153 <premain>: CommandLine Error: Argument 'misched' defined more than once! <premain>: CommandLine Error: Argument 'print-machineinstrs' defined more than once! -simplifycfg: CommandLine Error: Argument 'misched' defined more than once! -simplifycfg: CommandLine Error: Argument 'print-machineinstrs' defined more than once!