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 Aug 31, 2024
1 parent ab18eaa commit b9c6c3f
Show file tree
Hide file tree
Showing 56 changed files with 440 additions and 553 deletions.
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
3 changes: 2 additions & 1 deletion bench/bench_queue.ml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,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 +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 ()
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_stack.ml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,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 +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 ()
Times.record ~budgetf ~n_domains ~init ~wrap ~work ()
|> Times.to_thruput_metrics ~n:n_msgs ~singular:"message" ~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
16 changes: 8 additions & 8 deletions doc/dune
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
(mdx
(package kcas_data)
(deps
(package kcas)
(package kcas_data))
(enabled_if
(>= %{ocaml_version} 5.0.0))
(files gkmz-with-read-only-cmp-ops.md scheduler-interop.md))
;(mdx
; (package kcas_data)
; (deps
; (package kcas)
; (package kcas_data))
; (enabled_if
; (>= %{ocaml_version} 5.0.0))
; (files gkmz-with-read-only-cmp-ops.md scheduler-interop.md))
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))
10 changes: 4 additions & 6 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@
(>= 4.13.0))
(backoff
(>= 0.1.0))
(domain-local-await
(>= 1.0.1))
(domain-local-timeout
(>= 1.0.1))
(picos
(>= 0.5.0))
(multicore-magic
(>= 2.3.0))
(domain_shims
Expand Down Expand Up @@ -84,9 +82,9 @@
(and
(>= 0.1.0)
:with-test))
(domain-local-await
(picos
(and
(>= 1.0.1)
(>= 0.5.0)
:with-test))
(domain_shims
(and
Expand Down
13 changes: 13 additions & 0 deletions dune-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
(lang dune 3.9)

(env
(dev
(ocamlopt_flags
(:standard -S))
(flags
(:standard -warn-error -A)))
(release
(ocamlopt_flags
(:standard -S))))

(display verbose)
6 changes: 4 additions & 2 deletions kcas.opam
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ depends: [
"dune" {>= "3.14"}
"ocaml" {>= "4.13.0"}
"backoff" {>= "0.1.0"}
"domain-local-await" {>= "1.0.1"}
"domain-local-timeout" {>= "1.0.1"}
"picos" {>= "0.5.0"}
"multicore-magic" {>= "2.3.0"}
"domain_shims" {>= "0.1.0" & with-test}
"alcotest" {>= "1.8.0" & with-test}
Expand All @@ -46,3 +45,6 @@ build: [
]
dev-repo: "git+https://github.com/ocaml-multicore/kcas.git"
doc: "https://ocaml-multicore.github.io/kcas/doc/kcas/Kcas/"
pin-depends: [
[ "picos.dev" "git+https://github.com/ocaml-multicore/picos#383e3eef900621dc55ecde58a36bdd2e9ae5a2db" ]
]
3 changes: 3 additions & 0 deletions kcas.opam.template
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
doc: "https://ocaml-multicore.github.io/kcas/doc/kcas/Kcas/"
pin-depends: [
[ "picos.dev" "git+https://github.com/ocaml-multicore/picos#383e3eef900621dc55ecde58a36bdd2e9ae5a2db" ]
]
2 changes: 1 addition & 1 deletion kcas_data.opam
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ depends: [
"kcas" {= version}
"multicore-magic" {>= "2.3.0"}
"backoff" {>= "0.1.0" & with-test}
"domain-local-await" {>= "1.0.1" & with-test}
"picos" {>= "0.5.0" & with-test}
"domain_shims" {>= "0.1.0" & with-test}
"multicore-bench" {>= "0.1.4" & with-test}
"alcotest" {>= "1.8.0" & with-test}
Expand Down
14 changes: 7 additions & 7 deletions src/kcas/dune
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
(library
(name kcas)
(public_name kcas)
(libraries domain-local-await domain-local-timeout backoff multicore-magic))
(libraries picos backoff multicore-magic))

(mdx
(package kcas)
(deps
(package kcas))
(libraries kcas backoff domain_shims)
(files kcas.mli))
;(mdx
; (package kcas)
; (deps
; (package kcas))
; (libraries kcas backoff domain_shims)
; (files kcas.mli))
Loading

0 comments on commit b9c6c3f

Please sign in to comment.