/mobile Handheld Friendly website
x64 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 |
|---|---|---|---|---|---|
| 1,000 | 0.57 | 0.60 | 17,332 | 1043 | 2% 0% 3% 100% |
| 4,000 | 36.38 | 36.39 | 18,584 | 1043 | 1% 0% 0% 100% |
| 16,000 | 184.61 | 184.65 | 18,592 | 1043 | 0% 0% 0% 100% |
Read the ↓ make, command line, and program output logs to see how this program was run.
Read mandelbrot 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 21:22:20 PST 2013)
LLVM: yes(3.2svn-mono)
(* The Computer Language Benchmarks Game http://benchmarksgame.alioth.debian.org/ Adapted by Antti Lankila from the earlier Isaac Gouy's implementation Add multithread & tweaks from C++ by The Anh Tran Ported to F# by Don Syme Add memory reduction and performance tweaks by Jomo Fisher *) open System open System.Threading open System.IO let out = Console.OpenStandardOutput() // Helper type to accumulate a bit array type BitAccumulator(n) = let numBytes = (n+7)/8 let numBits = n &&& 7 let mutable byteCount = 0 let mutable bitNum = 0 let mutable byteAcc = 0 let mutable pdata : byte array = Array.zeroCreate numBytes member x.Reinit() = byteCount <- 0 bitNum <- 0 byteAcc <- 0 member x.Add b = byteAcc <- (byteAcc <<< 1) ||| (if b then 1 else 0); bitNum <- bitNum + 1 if bitNum = 8 then pdata.[byteCount] <- byte byteAcc; byteCount <- byteCount + 1; byteAcc <- 0; bitNum <- 0; member x.Close() = // write left over bits if bitNum <> 0 then byteAcc <- byteAcc <<< (8 - numBits) pdata.[byteCount] <- byte byteAcc byteCount <- byteCount+1 member x.Data = pdata member x.ByteCount = byteCount type ThreadState(n) = let ba = BitAccumulator(n) let mutable finishedLine = -1 member ts.BitAccumulator = ba member ts.IsReadyToWork = finishedLine = -1 member ts.SetFinishedLine(lineNumber) = finishedLine <- lineNumber member ts.TryWriteLine(nextLine) = if finishedLine = nextLine then out.Write( ba.Data, 0, ba.ByteCount); finishedLine <- -1 ba.Reinit() true else false // Initialize an array by a parallel init using all available processors let parallelArrayInit n f = let currentLine = ref -1 let lastWritten = ref -1 let rec loop (ts:ThreadState) = if ts.IsReadyToWork then let y = Interlocked.Increment(¤tLine.contents) if y < n then f ts.BitAccumulator y ts.SetFinishedLine(y) loop(ts) elif ts.TryWriteLine(!lastWritten + 1) then Interlocked.Increment(&lastWritten.contents) |> ignore loop(ts) else loop(ts) Async.Parallel [ for i in 1 .. Environment.ProcessorCount -> async {do loop(ThreadState(n)) } ] |> Async.Ignore |> Async.RunSynchronously [<EntryPoint>] let main args = let start = System.DateTime.Now let numLines = if (args.Length > 0) then int args.[0] else 200 Console.Out.Write("P4\n{0} {0}\n", numLines); let inversen = 2.0 / float numLines; parallelArrayInit numLines (fun ba y -> let civ = float y * inversen - 1.0; for x = 0 to numLines - 1 do let crv = float x * inversen - 1.5; let rec innerLoop i zrv ziv trv tiv = let ziv = (zrv*ziv) + (zrv*ziv) + civ; let zrv = trv - tiv + crv; let trv = zrv * zrv; let tiv = ziv * ziv; if ((trv + tiv) <= 4.0) && (i > 0) then innerLoop (i-1) zrv ziv trv tiv else i let i = innerLoop 49 crv civ (crv * crv) (civ * civ) ba.Add ((i = 0)) ba.Close()) 0
Wed, 13 Feb 2013 10:56:37 GMT MAKE: mv mandelbrot.fsharp-2.fsharp mandelbrot.fsharp-2.fs /usr/local/bin/fsharpc --target:exe --platform:x64 -O -o mandelbrot.fsharp-2.fsharp_run.exe mandelbrot.fsharp-2.fs Microsoft (R) F# 3.0 Compiler version (Mono build) Copyright (c) Microsoft Corporation. All Rights Reserved. /home/dunham/benchmarksgame_onecore/mandelbrot/tmp/mandelbrot.fsharp-2.fs(10,1): warning FS0221: The declarations in this file will be placed in an implicit module 'Mandelbrot.fsharp-2' based on the file name 'mandelbrot.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 mandelbrot.fsharp-2.fs 4.39s to complete and log all make actions COMMAND LINE: /usr/local/bin/mono --llvm -O=unsafe mandelbrot.fsharp-2.fsharp_run.exe 16000 (BINARY) PROGRAM OUTPUT NOT SHOWN <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!