From 28957cd8f83e27738f839e0e6673c64f2bebd854 Mon Sep 17 00:00:00 2001 From: Bikal Lem Date: Wed, 27 Oct 2021 13:40:19 +0100 Subject: [PATCH] make domainslib build/run with OCaml 5.00 after PR #704 --- .github/workflows/main.yml | 2 +- domainslib.opam | 1 + lib/multi_channel.ml | 2 +- lib/task.ml | 2 +- lib/ws_deque.ml | 2 +- test/dune | 2 +- test/task_throughput.ml | 4 ++-- 7 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index abe19b9..17be0d5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -41,7 +41,7 @@ jobs: default: https://github.com/ocaml/opam-repository.git cache-prefix: ${{ steps.multicore_hash.outputs.commit }} - - run: opam install . --deps-only + - run: opam install . --deps-only --with-test - run: opam exec -- make all diff --git a/domainslib.opam b/domainslib.opam index 537ef7f..da7a99e 100644 --- a/domainslib.opam +++ b/domainslib.opam @@ -12,6 +12,7 @@ depends: [ "base-domains" "ocamlfind" {build} "dune" {build} + "mirage-clock-unix" {with-test} ] depopts: [] build: [ diff --git a/lib/multi_channel.ml b/lib/multi_channel.ml index 63888e5..1d2d375 100644 --- a/lib/multi_channel.ml +++ b/lib/multi_channel.ml @@ -149,7 +149,7 @@ let rec recv_poll_repeated mchan dls repeats = | Exit -> if repeats = 1 then raise Exit else begin - Domain.Sync.cpu_relax (); + Domain.cpu_relax (); recv_poll_repeated mchan dls (repeats - 1) end diff --git a/lib/task.ml b/lib/task.ml index b3138ac..0d8d28c 100644 --- a/lib/task.ml +++ b/lib/task.ml @@ -75,7 +75,7 @@ let rec await pool promise = | Task (t, p) -> do_task t p | Quit -> raise TasksActive with - | Exit -> Domain.Sync.cpu_relax () + | Exit -> Domain.cpu_relax () end; await pool promise | Some (Ok v) -> v diff --git a/lib/ws_deque.ml b/lib/ws_deque.ml index 2e89885..d5675f4 100644 --- a/lib/ws_deque.ml +++ b/lib/ws_deque.ml @@ -189,7 +189,7 @@ module M : S = struct if Atomic.compare_and_set q.top t (t + 1) then release out else begin - Domain.Sync.cpu_relax (); + Domain.cpu_relax (); steal q end diff --git a/test/dune b/test/dune index 18d93cc..a37c387 100644 --- a/test/dune +++ b/test/dune @@ -59,7 +59,7 @@ (test (name task_throughput) - (libraries domainslib) + (libraries domainslib mirage-clock-unix) (modules task_throughput) (modes native)) diff --git a/test/task_throughput.ml b/test/task_throughput.ml index f451638..abec383 100644 --- a/test/task_throughput.ml +++ b/test/task_throughput.ml @@ -54,9 +54,9 @@ let _ = let hist = TimingHist.make 5 25 in for _ = 1 to n_iterations do - let t0 = Domain.timer_ticks () in + let t0 = Mclock.elapsed_ns() in T.parallel_for pool ~start:1 ~finish:n_tasks ~body:(fun _ -> ()); - let t = Int64.sub (Domain.timer_ticks ()) t0 in + let t = Int64.sub (Mclock.elapsed_ns ()) t0 in TimingHist.add_point hist (Int64.to_int t); done;