performance measurements

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,000Failed  555   

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

Read thread-ring benchmark to see what this program should do.


F# Compiler for F# 3.1 (Open Source Edition)

Mono JIT compiler version 4.1.0 (master/435cc01 Wed May 20 22:58:47 PDT 2015)
LLVM: yes(3.6.0svn-mono-master/ce4fcec)
GC: sgen

 thread-ring F# Mono #2 program source code

(*  The Computer Language Benchmarks Game

    Contributed by Dmitry Lomov & Jomo Fisher

    Uses F# asyncs (lightweight threads) with customized auto reset cell 
    as semaphore.

let ringLength = 503

type AutoResetCell() =
    let mutable value = -1
    let mutable run = None
    member this.RegisterResult res =
        let grabbed = 
            lock this (fun () ->
                match run with
                | None -> value <- res; None
                | grabbed -> run <- None; grabbed)
        match grabbed with
        | None -> ()
        | Some run -> run res

    member this.AsyncResult = 
        Async.FromContinuations(fun (success,_,_) -> 
            let runNow = 
                lock this (fun () ->
                    if value = -1 then
                        run <- Some success
                    else true)                        
            if runNow then 
                let r = value
                value <- -1 // Autoreset
                success r) 

let createCell _ = AutoResetCell()

let createThread (cells:AutoResetCell array) i =
    let next = if i = ringLength-1 then 0 else i + 1
    async {
            let more = ref true
            while !more do
                let! msg = cells.[i].AsyncResult 
                more := msg>0
                if msg = 0 then                    
                    printfn "%d" (i+1) }

let main args = 
    let count = if args.Length>0 then int args.[0] else 50000000
    let cells = Array.init ringLength createCell

    let threads = Array.init ringLength (createThread cells)


        |> Async.Parallel // Run all the asyncs at once
        |> Async.Ignore // Ignore the results
        |> Async.RunSynchronously // Block the main thread until work is done

 make, command-line, and program output logs

Fri, 22 May 2015 20:11:52 GMT

mv threadring.fsharp-2.fsharp threadring.fsharp-2.fs
/usr/local/bin/fsharpc --target:exe --platform:x64 -O  -o threadring.fsharp-2.fsharp_run.exe threadring.fsharp-2.fs
F# Compiler for F# 3.1 (Open Source Edition)
Freely distributed under the Apache 2.0 Open Source License

/home/dunham/benchmarksgame_onecore/threadring/tmp/threadring.fsharp-2.fs(10,1): warning FS0221: The declarations in this file will be placed in an implicit module 'Threadring.fsharp-2' based on the file name 'threadring.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 threadring.fsharp-2.fs
4.39s to complete and log all make actions

/usr/local/bin/mono --llvm threadring.fsharp-2.fsharp_run.exe 500000



mono: /usr/local/src/llvm/include/llvm/IR/Instructions.h:999: void llvm::ICmpInst::AssertOK(): Assertion `getOperand(0)->getType() == getOperand(1)->getType() && "Both operands to ICmp instruction are not of the same type!"' failed.

  at <unknown> <0xffffffff>
  at Microsoft.FSharp.Control.CancellationTokenOps.RunSynchronously<T_REF> (System.Threading.CancellationToken,Microsoft.FSharp.Control.FSharpAsync`1<T_REF>,Microsoft.FSharp.Core.FSharpOption`1<int>) <0x000e6>
  at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously<T_REF> (Microsoft.FSharp.Control.FSharpAsync`1<T_REF>,Microsoft.FSharp.Core.FSharpOption`1<int>,Microsoft.FSharp.Core.FSharpOption`1<System.Threading.CancellationToken>) <0x00107>
  at Threadring.fsharp-2.main (string[]) <0x00137>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object (object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

	/usr/local/bin/mono() [0x61d0e0]
	/lib/x86_64-linux-gnu/ [0x7fe906c21d10]
	/lib/x86_64-linux-gnu/ [0x7fe906666267]
	/lib/x86_64-linux-gnu/ [0x7fe906667eca]
	/lib/x86_64-linux-gnu/ [0x7fe90665f03d]
	/lib/x86_64-linux-gnu/ [0x7fe90665f0f2]
	/usr/local/bin/mono() [0x7da6c6]
	/usr/local/bin/mono(LLVMBuildICmp+0x47) [0x112b6c7]
	/usr/local/bin/mono() [0x658617]
	/usr/local/bin/mono() [0x6922b9]
	/usr/local/bin/mono() [0x6930b7]
	/usr/local/bin/mono() [0x59ee7c]
	/usr/local/bin/mono() [0x59f4bb]
	/usr/local/bin/mono() [0x61e370]

Debug info from gdb:

Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.

Revised BSD license

  Home   Conclusions   License   Play