Skip to content

Commit

Permalink
Change to use Picos instead of DLT and DLA
Browse files Browse the repository at this point in the history
This adds support for cancelation through Picos and removes explicit support for
timeouts, which simplifies the library.  This basically also means that one can
no longer use Kcas without a scheduler.
  • Loading branch information
polytypic committed Sep 4, 2024
1 parent ab18eaa commit 01effba
Show file tree
Hide file tree
Showing 63 changed files with 759 additions and 986 deletions.
4 changes: 2 additions & 2 deletions bench/bench_accumulator.ml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let run_one ~budgetf ~n_domains ?(n_ops = 180 * Util.iter_factor) () =
let n_ops_todo = Atomic.make n_ops |> Multicore_magic.copy_as_padded in

let init _ = () in

let wrap _ _ action = Scheduler.run action in
let work _ () =
let rec work () =
let n = Util.alloc n_ops_todo in
Expand All @@ -34,7 +34,7 @@ let run_one ~budgetf ~n_domains ?(n_ops = 180 * Util.iter_factor) () =
(if n_domains = 1 then "" else "s")
in

Times.record ~budgetf ~n_domains ~init ~work ~after ()
Times.record ~budgetf ~n_domains ~init ~wrap ~work ~after ()
|> Times.to_thruput_metrics ~n:n_ops ~config ~singular:"operation"

let run_suite ~budgetf =
Expand Down
6 changes: 4 additions & 2 deletions bench/bench_dllist.ml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ let run_single ~budgetf ?(n_msgs = 15 * Util.iter_factor) () =
assert (Dllist.is_empty t);
Util.generate_push_and_pop_sequence n_msgs
in
let wrap _ _ action = Scheduler.run action in
let work _ bits = Util.Bits.iter op bits in

Times.record ~budgetf ~n_domains:1 ~init ~work ()
Times.record ~budgetf ~n_domains:1 ~init ~wrap ~work ()
|> Times.to_thruput_metrics ~n:n_msgs ~singular:"message" ~config:"one domain"

let run_one ~budgetf ?(n_adders = 2) ?(n_takers = 2) ?(factor = 1)
Expand All @@ -31,6 +32,7 @@ let run_one ~budgetf ?(n_adders = 2) ?(n_takers = 2) ?(factor = 1)
Atomic.set n_msgs_to_take n_msgs;
Atomic.set n_msgs_to_add n_msgs
in
let wrap _ _ action = Scheduler.run action in
let work i () =
if i < n_adders then
let rec work () =
Expand Down Expand Up @@ -70,7 +72,7 @@ let run_one ~budgetf ?(n_adders = 2) ?(n_takers = 2) ?(factor = 1)
(format "taker" false n_takers)
in

Times.record ~budgetf ~n_domains ~init ~work ()
Times.record ~budgetf ~n_domains ~init ~wrap ~work ()
|> Times.to_thruput_metrics ~n:n_msgs ~singular:"message" ~config

let run_suite ~budgetf =
Expand Down
4 changes: 2 additions & 2 deletions bench/bench_hashtbl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ let run_one ~budgetf ~n_domains ?(n_ops = 40 * Util.iter_factor)
Atomic.set n_ops_todo n_ops;
Random.State.make_self_init ()
in

let wrap _ _ action = Scheduler.run action in
let work _ state =
let rec work () =
let n = Util.alloc n_ops_todo in
Expand Down Expand Up @@ -56,7 +56,7 @@ let run_one ~budgetf ~n_domains ?(n_ops = 40 * Util.iter_factor)
percent_read
in

Times.record ~budgetf ~n_domains ~init ~work ()
Times.record ~budgetf ~n_domains ~init ~wrap ~work ()
|> Times.to_thruput_metrics ~n:n_ops ~singular:"operation" ~config

let run_suite ~budgetf =
Expand Down
3 changes: 2 additions & 1 deletion bench/bench_mvar.ml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ let run_one ~budgetf ?(n_adders = 2) ?(blocking_add = false) ?(n_takers = 2)
let n_msgs_to_add = Atomic.make n_msgs |> Multicore_magic.copy_as_padded in

let init _ = () in
let wrap _ _ action = Scheduler.run action in
let work i () =
if i < n_adders then
if blocking_add then
Expand Down Expand Up @@ -79,7 +80,7 @@ let run_one ~budgetf ?(n_adders = 2) ?(blocking_add = false) ?(n_takers = 2)
(format "taker" blocking_take n_takers)
in

Times.record ~budgetf ~n_domains ~init ~work ~after ()
Times.record ~budgetf ~n_domains ~init ~wrap ~work ~after ()
|> Times.to_thruput_metrics ~n:n_msgs ~singular:"message" ~config

let run_suite ~budgetf =
Expand Down
4 changes: 2 additions & 2 deletions bench/bench_parallel_cmp.ml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let run_one ~budgetf ~n_domains ?(n_ops = 50 * Util.iter_factor) () =
let n_ops_todo = Atomic.make n_ops |> Multicore_magic.copy_as_padded in

let init i = Array.unsafe_get xs i in

let wrap _ _ action = Scheduler.run action in
let work _ x =
let tx1 ~xt =
let a = Xt.get ~xt a in
Expand Down Expand Up @@ -41,7 +41,7 @@ let run_one ~budgetf ~n_domains ?(n_ops = 50 * Util.iter_factor) () =
Printf.sprintf "%d worker%s" n_domains (if n_domains = 1 then "" else "s")
in

Times.record ~budgetf ~n_domains ~init ~work ~after ()
Times.record ~budgetf ~n_domains ~init ~wrap ~work ~after ()
|> Times.to_thruput_metrics ~n:n_ops ~singular:"transaction" ~config

let run_suite ~budgetf =
Expand Down
6 changes: 4 additions & 2 deletions bench/bench_queue.ml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ let run_one_domain ~budgetf ?(n_msgs = 50 * Util.iter_factor) () =
assert (Queue.is_empty t);
Util.generate_push_and_pop_sequence n_msgs
in
let wrap _ _ action = Scheduler.run action in
let work _ bits = Util.Bits.iter op bits in

Times.record ~budgetf ~n_domains:1 ~init ~work ()
Times.record ~budgetf ~n_domains:1 ~init ~wrap ~work ()
|> Times.to_thruput_metrics ~n:n_msgs ~singular:"message" ~config:"one domain"

let run_one ~budgetf ?(n_adders = 2) ?(blocking_add = false) ?(n_takers = 2)
Expand All @@ -29,6 +30,7 @@ let run_one ~budgetf ?(n_adders = 2) ?(blocking_add = false) ?(n_takers = 2)
Atomic.set n_msgs_to_take n_msgs;
Atomic.set n_msgs_to_add n_msgs
in
let wrap _ _ action = Scheduler.run action in
let work i () =
if i < n_adders then
let rec work () =
Expand Down Expand Up @@ -79,7 +81,7 @@ let run_one ~budgetf ?(n_adders = 2) ?(blocking_add = false) ?(n_takers = 2)
(format "taker" blocking_take n_takers)
in

Times.record ~budgetf ~n_domains ~init ~work ()
Times.record ~budgetf ~n_domains ~init ~wrap ~work ()
|> Times.to_thruput_metrics ~n:n_msgs ~singular:"message" ~config

let run_suite ~budgetf =
Expand Down
6 changes: 4 additions & 2 deletions bench/bench_stack.ml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ let run_one_domain ~budgetf ?(n_msgs = 50 * Util.iter_factor) () =
assert (Stack.is_empty t);
Util.generate_push_and_pop_sequence n_msgs
in
let wrap _ _ action = Scheduler.run action in
let work _ bits = Util.Bits.iter op bits in

Times.record ~budgetf ~n_domains:1 ~init ~work ()
Times.record ~budgetf ~n_domains:1 ~init ~wrap ~work ()
|> Times.to_thruput_metrics ~n:n_msgs ~singular:"message" ~config:"one domain"

let run_one ~budgetf ?(n_adders = 2) ?(blocking_add = false) ?(n_takers = 2)
Expand All @@ -29,6 +30,7 @@ let run_one ~budgetf ?(n_adders = 2) ?(blocking_add = false) ?(n_takers = 2)
Atomic.set n_msgs_to_take n_msgs;
Atomic.set n_msgs_to_add n_msgs
in
let wrap _ _ action = Scheduler.run action in
let work i () =
if i < n_adders then
let rec work () =
Expand Down Expand Up @@ -79,7 +81,7 @@ let run_one ~budgetf ?(n_adders = 2) ?(blocking_add = false) ?(n_takers = 2)
(format "taker" blocking_take n_takers)
in

Times.record ~budgetf ~n_domains ~init ~work ()
Times.record ~budgetf ~n_domains ~init ~wrap ~work ()
|> Times.to_thruput_metrics ~n:n_msgs ~singular:"message" ~config

let run_suite ~budgetf =
Expand Down
3 changes: 2 additions & 1 deletion bench/bench_xt.ml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ let run_one ~budgetf ?(n_locs = 2)
in

let init _ = () in
let wrap _ _ action = Scheduler.run action in
let work _ () =
let rec loop i =
if i > 0 then begin
Expand All @@ -27,7 +28,7 @@ let run_one ~budgetf ?(n_locs = 2)

let config = Printf.sprintf "%d loc tx" n_locs in

Times.record ~budgetf ~n_domains:1 ~init ~work ()
Times.record ~budgetf ~n_domains:1 ~init ~wrap ~work ()
|> Times.to_thruput_metrics ~n:n_iter ~singular:"transaction" ~config

let run_suite ~budgetf =
Expand Down
3 changes: 2 additions & 1 deletion bench/bench_xt_ro.ml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ let run_one ~budgetf ?(n_locs = 2)
in

let init _ = () in
let wrap _ _ action = Scheduler.run action in
let work _ () =
let rec loop i =
if i > 0 then begin
Expand All @@ -27,7 +28,7 @@ let run_one ~budgetf ?(n_locs = 2)

let config = Printf.sprintf "%d loc tx" n_locs in

Times.record ~budgetf ~n_domains:1 ~init ~work ()
Times.record ~budgetf ~n_domains:1 ~init ~wrap ~work ()
|> Times.to_thruput_metrics ~n:n_iter ~singular:"transaction" ~config

let run_suite ~budgetf =
Expand Down
1 change: 1 addition & 0 deletions bench/dune
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ let () =
(action
(run %{test} -brief))
(libraries
scheduler
kcas_data
multicore-bench
backoff
Expand Down
2 changes: 1 addition & 1 deletion doc/dune
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
(package kcas_data))
(enabled_if
(>= %{ocaml_version} 5.0.0))
(files gkmz-with-read-only-cmp-ops.md scheduler-interop.md))
(files gkmz-with-read-only-cmp-ops.md))
178 changes: 0 additions & 178 deletions doc/scheduler-interop.md

This file was deleted.

14 changes: 7 additions & 7 deletions dune
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(mdx
(package kcas_data)
(deps
(package kcas)
(package kcas_data))
(libraries domain_shims)
(files README.md))
;(mdx
; (package kcas_data)
; (deps
; (package kcas)
; (package kcas_data))
; (libraries domain_shims)
; (files README.md))
Loading

0 comments on commit 01effba

Please sign in to comment.