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

Update benchmarks and domainslib to support ocaml 4.14.0+domains (ocaml 5.0) #261

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1b45ac6
update test_decompress_multicore.ml
shubhamkumar13 Nov 8, 2021
de7013e
update camera.ml for minilight_multicore.ml
shubhamkumar13 Nov 8, 2021
cfc172c
update minilight_multicore.ml
shubhamkumar13 Nov 8, 2021
f042376
update LU_decomposition_multicore.ml
shubhamkumar13 Nov 8, 2021
95b26c7
update test_spsc_queue_pingpong_parallel.ml
shubhamkumar13 Nov 8, 2021
4a8e72c
update binarytree5_multicore.ml
shubhamkumar13 Nov 8, 2021
5c84e26
update evolutionary_algorithm_multicore.ml
shubhamkumar13 Nov 9, 2021
14a13f3
update floyd_warshall_multicore.ml
shubhamkumar13 Nov 9, 2021
0c7ce0d
update game_of_life_multicore.ml
shubhamkumar13 Nov 9, 2021
5aa80d4
update mandelbrot6_multicore.ml
shubhamkumar13 Nov 9, 2021
a4209a0
update matrix_multiplication_multicore.ml
shubhamkumar13 Nov 9, 2021
3c57c4a
update mergesort_multicore.ml
shubhamkumar13 Nov 9, 2021
b35b7a9
update nbody_multicore.ml
shubhamkumar13 Nov 9, 2021
8db8103
update quicksort_multicore.ml
shubhamkumar13 Nov 9, 2021
723c8ea
update spectralnorm2_multicore.ml
shubhamkumar13 Nov 9, 2021
11bf65c
update domainslib.0.3.0 to 0.3.2
shubhamkumar13 Nov 9, 2021
feb08cd
remove base-domains from domainslib dependency
shubhamkumar13 Nov 9, 2021
c78ccf1
update the ocaml-version for 4.14.0+trunk to 5.00.0+trunk and update …
shubhamkumar13 Nov 15, 2021
e67f4e0
disable irmin benchmarks when 5.00 and update trunk to 5.00
shubhamkumar13 Nov 18, 2021
5eb8ea5
Merge branch 'update-benchmarks-for-ocaml-5.0' of github.com:shubhamk…
shubhamkumar13 Nov 18, 2021
6d5dd56
rename pipeline name to 5.00
shubhamkumar13 Nov 18, 2021
418ccdc
add ppxlib and it's dependencies in case statement to ensure that oca…
shubhamkumar13 Nov 22, 2021
995cc38
Remove stdio and other deps which depend on stdio
shubhamkumar13 Nov 22, 2021
62b28a5
remove 4.12.0+stock+serial
shubhamkumar13 Nov 22, 2021
eca5702
remove all 4.12.* pipelines from drone yaml file
shubhamkumar13 Nov 22, 2021
7633b59
update to 4.14.0+domains+parallel
shubhamkumar13 Nov 23, 2021
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
62 changes: 6 additions & 56 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
kind: pipeline
name: 4.14.0+trunk+serial
name: 5.00.0+trunk+serial

platform:
os: linux
arch: amd64

steps:
- name: 4.14.0+trunk
- name: 5.00.0+trunk
image: ocaml/opam:ubuntu-20.04-ocaml-4.12
commands:
- sudo apt-get update && sudo apt-get -y install wget pkg-config libgmp-dev m4 libdw-dev jq python3-pip
Expand All @@ -18,57 +18,7 @@ steps:
- export ITER=1
- export OPAM_DISABLE_SANDBOXING=true
- TAG='"run_in_ci"' make run_config_filtered.json
- RUN_CONFIG_JSON=run_config_filtered.json make ocaml-versions/4.14.0+trunk.bench
- ls _results
- cat _results/*

---
kind: pipeline
name: 4.12.0+stock+serial

platform:
os: linux
arch: amd64

steps:
- name: 4.12.0+stock
image: ocaml/opam:ubuntu-20.04-ocaml-4.12
commands:
- sudo apt-get update && sudo apt-get -y install wget pkg-config libgmp-dev m4 libdw-dev jq python3-pip
- pip3 install intervaltree
- sudo chown -R opam .
- eval $(opam env)
- opam update
- opam install dune.2.9.0
- export ITER=1
- export OPAM_DISABLE_SANDBOXING=true
- TAG='"run_in_ci"' make run_config_filtered.json
- RUN_CONFIG_JSON=run_config_filtered.json make ocaml-versions/4.12.0+stock.bench
- ls _results
- cat _results/*

---
kind: pipeline
name: 4.12.0+domains+serial

platform:
os: linux
arch: amd64

steps:
- name: 4.12.0+domains+serial
image: ocaml/opam:ubuntu-20.04-ocaml-4.12
commands:
- sudo apt-get update && sudo apt-get -y install wget pkg-config libgmp-dev m4 libdw-dev jq python3-pip
- pip3 install intervaltree
- sudo chown -R opam .
- eval $(opam env)
- opam update
- opam install dune.2.9.0
- export ITER=1
- export OPAM_DISABLE_SANDBOXING=true
- TAG='"run_in_ci"' make run_config_filtered.json
- RUN_CONFIG_JSON=run_config_filtered.json make ocaml-versions/4.12.0+domains.bench
- RUN_CONFIG_JSON=run_config_filtered.json make ocaml-versions/5.00.0+trunk.bench
shakthimaan marked this conversation as resolved.
Show resolved Hide resolved
- ls _results
- cat _results/*

Expand Down Expand Up @@ -99,14 +49,14 @@ steps:

---
kind: pipeline
name: 4.12.0+domains+parallel
name: 4.14.0+domains+parallel

platform:
os: linux
arch: amd64

steps:
- name: 4.12.0+domains+parallel
- name: 4.14.0+domains+parallel
image: ocaml/opam:ubuntu-20.04-ocaml-4.12
commands:
- sudo apt-get update && sudo apt-get -y install wget pkg-config libgmp-dev m4 libdw-dev jq python3-pip
Expand All @@ -120,7 +70,7 @@ steps:
- TAG='"run_in_ci"' make multicore_parallel_run_config_filtered.json
- TAG='"macro_bench"' make multicore_parallel_run_config_filtered_filtered.json
- make multicore_parallel_run_config_filtered_filtered_2domains.json
- BUILD_BENCH_TARGET=multibench_parallel RUN_CONFIG_JSON=multicore_parallel_run_config_filtered_filtered_2domains.json make ocaml-versions/4.12.0+domains.bench
- BUILD_BENCH_TARGET=multibench_parallel RUN_CONFIG_JSON=multicore_parallel_run_config_filtered_filtered_2domains.json make ocaml-versions/4.14.0+domains.bench
- ls _results
- cat _results/*

Expand Down
20 changes: 11 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ WRAPPER = $(patsubst run_%,%,$(RUN_BENCH_TARGET))

PACKAGES = \
cpdf conf-pkg-config conf-zlib bigstringaf decompress camlzip menhirLib \
menhir minilight base stdio dune-private-libs dune-configurator camlimages \
yojson lwt zarith integers uuidm react ocplib-endian nbcodec checkseum \
sexplib0 eventlog-tools irmin cubicle conf-findutils index logs \
mtime ppx_deriving ppx_deriving_yojson ppx_irmin repr ppx_repr irmin-layers irmin-pack
menhir minilight base dune-private-libs dune-configurator camlimages \
yojson lwt zarith uuidm react ocplib-endian nbcodec checkseum \
sexplib0 eventlog-tools cubicle conf-findutils logs \
mtime repr

ifeq ($(findstring multibench,$(BUILD_BENCH_TARGET)),multibench)
PACKAGES += lockfree kcas domainslib ctypes.0.14.0+multicore
else
PACKAGES += ctypes.0.14.0+stock frama-c alt-ergo js_of_ocaml-compiler
PACKAGES += ctypes.0.14.0+stock frama-c alt-ergo
endif

DEPENDENCIES = libgmp-dev libdw-dev jq python3-pip pkg-config m4 # Ubuntu
Expand Down Expand Up @@ -110,10 +110,11 @@ ocaml-versions/%.bench: check_url depend log_sandmark_hash ocaml-versions/%.json
opam install --switch=$* --keep-build-dir --yes rungen orun
@# case statement to select the correct variant for omp and ppxlib
@{ case "$*" in \
*multicore*) opam install --switch=$* --keep-build-dir --yes ocaml-migrate-parsetree.2.1.0+multicore ppxlib.0.22.0+multicore ;; \
*effects*) opam install --switch=$* --keep-build-dir --yes ocaml-migrate-parsetree.2.1.0+multicore ppxlib.0.22.0+multicore ;; \
*domains*) opam install --switch=$* --keep-build-dir --yes ocaml-migrate-parsetree.2.2.0+stock ppxlib.0.22.0+stock ;; \
*) opam install --switch=$* --keep-build-dir --yes ocaml-migrate-parsetree.2.2.0+stock ppxlib.0.22.0+stock coq fraplib ;; \
*multicore*) opam install --switch=$* --keep-build-dir --yes stdio integers ocaml-migrate-parsetree.2.1.0+multicore ppxlib.0.22.0+multicore ppx_deriving ppx_deriving_yojson irmin ppx_irmin ppx_repr irmin-layers irmin-pack index ;; \
*effects*) opam install --switch=$* --keep-build-dir --yes stdio integers ocaml-migrate-parsetree.2.1.0+multicore ppxlib.0.22.0+multicore ppx_deriving ppx_deriving_yojson irmin ppx_irmin ppx_repr irmin-layers irmin-pack index ;; \
*domains*) opam install --switch=$* --keep-build-dir --yes stdio integers ocaml-migrate-parsetree.2.2.0+stock ppxlib.0.22.0+stock ppx_deriving ppx_deriving_yojson irmin ppx_irmin ppx_repr irmin-layers irmin-pack index ;; \
*5.00*) sed 's/(alias (name buildbench) (deps layers.exe irmin_mem_rw.exe))/; (alias (name buildbench) (deps layers.exe irmin_mem_rw.exe))/g' ./benchmarks/irmin/dune > ./benchmarks/irmin/dune ;; \
shubhamkumar13 marked this conversation as resolved.
Show resolved Hide resolved
*) opam install --switch=$* --keep-build-dir --yes stdio integers ocaml-migrate-parsetree.2.2.0+stock ppxlib.0.22.0+stock js_of_ocaml-compiler coq fraplib ppx_deriving ppx_deriving_yojson irmin ppx_irmin ppx_repr irmin-layers irmin-pack index ;; \
esac }; \
opam install --switch=$* --best-effort --keep-build-dir --yes $(PACKAGES) || $(CONTINUE_ON_OPAM_INSTALL_ERROR)
opam exec --switch $* -- opam list
Expand Down Expand Up @@ -173,6 +174,7 @@ clean:
rm -rf _results
rm -rf *filtered.json
rm -rf *~
git restore ./benchmarks/irmin/dune

list:
@echo $(ocamls)
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/decompress/test_decompress_multicore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ let work _i =
ignore (Atomic.fetch_and_add iter_count 1)

let () =
let pool = T.setup_pool ~num_additional_domains:(num_domains - 1) in
T.parallel_for pool ~start:1 ~finish:iterations ~body:work;
let pool = T.setup_pool ~num_additional_domains:(num_domains - 1) () in
T.parallel_for ~start:1 ~finish:iterations ~body:work pool;
T.teardown_pool pool;
assert ((Atomic.get iter_count) = iterations)
4 changes: 2 additions & 2 deletions benchmarks/multicore-minilight/parallel/camera.ml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ object (__)

(* do image sampling pixel loop *)
let () =
T.parallel_for pool ~start:0 ~finish:(image#height - 1)
T.parallel_for ~start:0 ~finish:(image#height - 1)
~body:(fun y -> for x = image#width - 1 downto 0 do

let random = Domain.DLS.get k in
Expand All @@ -104,7 +104,7 @@ object (__)
(* add radiance to pixel *)
image#addToPixel x y radiance

done )
done ) pool
in

image
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ try

(* create top-level rendering objects with model file, in this order
(image is mutable) *)
let pool = T.setup_pool ~num_additional_domains:(num_domains - 1) in
let pool = T.setup_pool ~num_additional_domains:(num_domains - 1) () in
let image = new Image.obj modelFile in
let camera = new Camera.obj modelFile pool in
let scene = new Scene.obj modelFile camera#eyePoint in
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/multicore-numerical/LU_decomposition_multicore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ module SquareMatrix = struct
fa
let parallel_create pool f : float array =
let fa = Array.create_float (mat_size * mat_size) in
T.parallel_for pool ~start:0 ~finish:( mat_size * mat_size - 1)
~body:(fun i -> fa.(i) <- f (i / mat_size) (i mod mat_size));
T.parallel_for ~start:0 ~finish:( mat_size * mat_size - 1)
~body:(fun i -> fa.(i) <- f (i / mat_size) (i mod mat_size)) pool;
fa

let get (m : float array) r c = m.(r * mat_size + c)
Expand Down Expand Up @@ -54,7 +54,7 @@ let lup pool (a0 : float array) =
a

let () =
let pool = T.setup_pool ~num_additional_domains:(num_domains - 1) in
let pool = T.setup_pool ~num_additional_domains:(num_domains - 1) () in
let a = parallel_create pool
(fun _ _ -> (Random.State.float (Domain.DLS.get k) 100.0) +. 1.0 ) in
let lu = lup pool a in
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/multicore-numerical/binarytrees5_multicore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module T = Domainslib.Task

let num_domains = try int_of_string Sys.argv.(1) with _ -> 1
let max_depth = try int_of_string Sys.argv.(2) with _ -> 10
let pool = T.setup_pool ~num_additional_domains:(num_domains - 1)
let pool = T.setup_pool ~num_additional_domains:(num_domains - 1) ()

type 'a tree = Empty | Node of 'a tree * 'a tree

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ let n = try int_of_string Sys.argv.(2) with _ -> 1000
let multicore_init pool num_domains x0 n f =
let a = Array.make n x0 in
T.parallel_for
pool ~start:0 ~finish:(n-1)
~body:(fun i -> a.(i) <- f ());
~start:0 ~finish:(n-1)
~body:(fun i -> a.(i) <- f ()) pool;
a

let evolutionary_algorithm
Expand All @@ -85,7 +85,7 @@ let evolutionary_algorithm

=

let pool = T.setup_pool ~num_additional_domains:(num_domains - 1) in
let pool = T.setup_pool ~num_additional_domains:(num_domains - 1) () in
let adam = random_individual n fitness in
let init_pop = multicore_init pool num_domains adam in
let pop0 = init_pop lambda (fun _ -> random_individual n fitness) in
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/multicore-numerical/floyd_warshall_multicore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ let f_w pool adj =
let ()=
Random.init 512;
let adj = make_adj n in
let pool = T.setup_pool ~num_additional_domains:(num_domains - 1) in
let pool = T.setup_pool ~num_additional_domains:(num_domains - 1) () in
(*
let adj = [|
[| Value 0; Value 8; Infinity; Value 1 |];
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/multicore-numerical/game_of_life_multicore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ let print g =
let next pool =
let g = !rg in
let new_g = !rg' in
T.parallel_for pool ~start:0 ~finish:(board_size - 1)
T.parallel_for ~start:0 ~finish:(board_size - 1)
~body:(fun x ->
for y = 0 to board_size - 1 do
new_g.(x).(y) <- next_cell g x y
done);
done) pool;
rg := new_g;
rg' := g

Expand All @@ -65,7 +65,7 @@ let rec repeat pool n =
| _-> next pool; repeat pool (n-1)

let ()=
let pool = T.setup_pool ~num_additional_domains:(num_domains - 1) in
let pool = T.setup_pool ~num_additional_domains:(num_domains - 1) () in
(* print !rg; *)
repeat pool n_times;
(* print !rg; *)
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/multicore-numerical/mandelbrot6_multicore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ let worker w h_lo h_hi =
buf

let _ =
let pool = T.setup_pool ~num_additional_domains:(num_domains - 1) in
let pool = T.setup_pool ~num_additional_domains:(num_domains - 1) () in
Printf.printf "P4\n%i %i\n%!" w w;
let out = Array.init w (fun _ -> Bytes.create 0) in
let work i = out.(i) <- worker w i (i+1) in
T.parallel_for pool ~start:0 ~finish:(w-1) ~body:work;
T.parallel_for ~start:0 ~finish:(w-1) ~body:work pool;
Array.iter (fun o -> Printf.printf "%a%!" output_bytes o) out;
T.teardown_pool pool
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ let matrix_multiply pool res x y =
let j_n = Array.length y.(0) in
let k_n = Array.length y in

T.parallel_for pool ~start:0 ~finish:(i_n - 1) ~body:(fun i ->
T.parallel_for ~start:0 ~finish:(i_n - 1) ~body:(fun i ->
for j = 0 to j_n -1 do
let w = ref 0 in
for k = 0 to k_n - 1 do
w := !w + x.(i).(k) * y.(k).(j);
done;
res.(i).(j) <- !w
done)
done) pool

let print_matrix m =
for i = 0 to pred (Array.length m) do
Expand All @@ -26,7 +26,7 @@ let print_matrix m =
done

let _ =
let pool = T.setup_pool ~num_additional_domains:(num_domains - 1) in
let pool = T.setup_pool ~num_additional_domains:(num_domains - 1) () in

let m1 = Array.init size (fun _ -> Array.init size (fun _ -> Random.int 100)) in
let m2 = Array.init size (fun _ -> Array.init size (fun _ -> Random.int 100)) in
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/multicore-numerical/mergesort_multicore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module T = Domainslib.Task
let num_domains = try int_of_string @@ Sys.argv.(1) with _ -> 1
let n = try int_of_string @@ Sys.argv.(2) with _ -> 1024
let min = 128
let pool = T.setup_pool ~num_additional_domains:(num_domains - 1)
let pool = T.setup_pool ~num_additional_domains:(num_domains - 1) ()

let _ = Random.init 42
let a = Array.init n (fun _ -> Random.int n)
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/multicore-numerical/nbody_multicore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ let bodies =
mass=(Random.float 10.) *. solar_mass; })

let () =
let pool = T.setup_pool ~num_additional_domains:(num_domains - 1) in
let pool = T.setup_pool ~num_additional_domains:(num_domains - 1) () in
offset_momentum bodies;
Printf.printf "%.9f\n" (energy pool bodies);
for _i = 1 to n do advance pool bodies 0.01 done;
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/multicore-numerical/quicksort_multicore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ let rec quicksort arr low high d pool =
end

let () =
let pool = T.setup_pool ~num_additional_domains:(num_domains - 1) in
let pool = T.setup_pool ~num_additional_domains:(num_domains - 1) () in
let arr = Array.init n (fun _ -> Random.int n) in
quicksort arr 0 (Array.length arr - 1) num_domains pool;
(* for i = 0 to Array.length arr - 1 do
Expand Down
10 changes: 5 additions & 5 deletions benchmarks/multicore-numerical/spectralnorm2_multicore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,26 @@ let eval_A i j = 1. /. float((i+j)*(i+j+1)/2+i+1)

let eval_A_times_u pool u v =
let n = Array.length v - 1 in
T.parallel_for pool ~start:0 ~finish:n
T.parallel_for ~start:0 ~finish:n
~body:(fun i ->
let vi = ref 0. in
for j = 0 to n do vi := !vi +. eval_A i j *. u.(j) done;
v.(i) <- !vi)
v.(i) <- !vi) pool

let eval_At_times_u pool u v =
let n = Array.length v -1 in
T.parallel_for pool ~start:0 ~finish:n
T.parallel_for ~start:0 ~finish:n
~body:(fun i ->
let vi = ref 0. in
for j = 0 to n do vi := !vi +. eval_A j i *. u.(j) done;
v.(i) <- !vi)
v.(i) <- !vi) pool

let eval_AtA_times_u pool u v =
let w = Array.make (Array.length u) 0.0 in
eval_A_times_u pool u w; eval_At_times_u pool w v

let () =
let pool = T.setup_pool ~num_additional_domains:(num_domains - 1) in
let pool = T.setup_pool ~num_additional_domains:(num_domains - 1) () in
let u = Array.make n 1.0 and v = Array.make n 0.0 in
for _i = 0 to 9 do
eval_AtA_times_u pool u v; eval_AtA_times_u pool v u
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ let first_queue = !last_queue
let rec spinning_enqueue q m =
match Spsc_queue.enqueue q m with
| true -> ()
| false -> Domain.Sync.cpu_relax(); spinning_enqueue q m
| false -> Domain.cpu_relax(); spinning_enqueue q m

let rec ping_pong_messages n in_queue out_queue =
match Spsc_queue.dequeue in_queue with
| None -> Domain.Sync.cpu_relax(); ping_pong_messages n in_queue out_queue
| None -> Domain.cpu_relax(); ping_pong_messages n in_queue out_queue
| Some(m) ->
begin
spinning_enqueue out_queue m;
Expand Down
Loading