Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move bench framework to multicore-bench project #179

Merged
merged 1 commit into from
Feb 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bench.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM ocaml/opam:debian-ocaml-5.1
RUN sudo ln -sf /usr/bin/opam-2.1 /usr/bin/opam
WORKDIR bench-dir
COPY *.opam ./
RUN opam remote add origin https://opam.ocaml.org && \
RUN opam remote add origin https://github.com/ocaml/opam-repository.git && \
opam update
RUN opam pin -yn --with-version=dev .
RUN opam install -y --deps-only --with-test .
Expand Down
13 changes: 0 additions & 13 deletions bench/barrier.ml

This file was deleted.

4 changes: 0 additions & 4 deletions bench/barrier.mli

This file was deleted.

174 changes: 0 additions & 174 deletions bench/bench.ml

This file was deleted.

27 changes: 0 additions & 27 deletions bench/bench.mli

This file was deleted.

25 changes: 5 additions & 20 deletions bench/bench_accumulator.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
open Kcas_data
open Bench
open Multicore_bench

let run_one ~budgetf ~n_domains ?(n_ops = 180 * Util.iter_factor) () =
let n_ops = n_ops * n_domains in
Expand Down Expand Up @@ -29,28 +29,13 @@ let run_one ~budgetf ~n_domains ?(n_ops = 180 * Util.iter_factor) () =

let after () = Atomic.set n_ops_todo n_ops in

let times = Times.record ~n_domains ~budgetf ~init ~work ~after () in

let name metric =
Printf.sprintf "%s/%d worker%s, 0%% reads" metric n_domains
let config =
Printf.sprintf "%d worker%s, 0%% reads" n_domains
(if n_domains = 1 then "" else "s")
in

List.concat
[
Stats.of_times times
|> Stats.scale (1_000_000_000.0 /. Float.of_int n_ops)
|> Stats.to_json
~name:(name "time per operation")
~description:"Average time to increment accumulator" ~units:"ns";
Times.invert times |> Stats.of_times
|> Stats.scale (Float.of_int (n_ops * n_domains) /. 1_000_000.0)
|> Stats.to_json
~name:(name "operations over time")
~description:
"Number of operations performed over time using all domains"
~units:"M/s";
]
Times.record ~budgetf ~n_domains ~init ~work ~after ()
|> Times.to_thruput_metrics ~n:n_ops ~config ~singular:"operation"

let run_suite ~budgetf =
[ 1; 2; 4 ]
Expand Down
19 changes: 3 additions & 16 deletions bench/bench_atomic.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
open Bench
open Multicore_bench

module Atomic = struct
include Stdlib.Atomic
Expand Down Expand Up @@ -31,21 +31,8 @@ let run_one ~budgetf ?(n_iter = 500 * Util.iter_factor)
loop n_iter
in

let times = Times.record ~n_domains:1 ~budgetf ~init ~work () in

List.concat
[
Stats.of_times times
|> Stats.scale (1_000_000_000.0 /. Float.of_int n_iter)
|> Stats.to_json
~name:(Printf.sprintf "time per op/%s" name)
~description:"Time to perform a single op" ~units:"ns";
Times.invert times |> Stats.of_times
|> Stats.scale (Float.of_int n_iter /. 1_000_000.0)
|> Stats.to_json
~name:(Printf.sprintf "ops over time/%s" name)
~description:"Number of operations performed over time" ~units:"M/s";
]
Times.record ~budgetf ~n_domains:1 ~init ~work ()
|> Times.to_thruput_metrics ~n:n_iter ~singular:"op" ~config:name

let run_suite ~budgetf =
[
Expand Down
Loading
Loading