Skip to content

Instantly share code, notes, and snippets.

@Sudha247
Sudha247 / array-init.ml
Last active April 28, 2020 08:58
Parallel float array initialization
module T = Domainslib.Task
let n = try int_of_string Sys.argv.(2) with _ -> 10000
let cs = try int_of_string Sys.argv.(3) with _ -> 32
let num_domains = try int_of_string Sys.argv.(1) with _ -> 4
let _ =
let arr = Array.create_float n in
(*init with random number*)
let pool = T.setup_pool ~num_domains:(num_domains - 1) in
T.parallel_for pool ~chunk_size:cs ~start:0 ~finish:(pred n) ~body:(fun i ->
module C = Domainslib.Chan
let num_domains = try int_of_string Sys.argv.(1) with _ -> 4
let n = try int_of_string Sys.argv.(2) with _ -> 1024
let chunk_size = n / num_domains
let a = Array.make n 1.
let b = Array.create_float n
type message =
Work of int * int
#!/usr/bin/env bash
set -x
for i in 1 2 4 8 12
do
time taskset --cpu-list 2-13 chrt -r 1 <exe> $i <arg>
done
for i in 16 20 24
let num_domains = try int_of_string Sys.argv.(1) with _ -> 1
open Domain.DLS
let chk () =
let k1 : int key = new_key () in
set k1 100;
Gc.major ();
Printf.printf "%d\n" (Option.get @@ get k1)
let _ =
{"name":"menhir.ocamly","command":"taskset --cpu-list 5 menhir benchmarks/menhir/ocaml.mly --list-errors -la 2 --no-stdlib --lalr","time_secs":255.25621914863586,"user_time_secs":251.729447,"sys_time_secs":3.523964,"maxrss_kB":3488920,"ocaml":{"version":"4.10.0+multicore","c_compiler":"gcc","architecture":"amd64","word_size":"64","system":"linux","stats":"false","function_sections":"true","supports_shared_libraries":"true"},"gc":{"allocated_words":3224810688,"minor_words":2504422218,"promoted_words":427841373,"major_words":1148229843,"minor_collections":9586,"major_collections":37,"heap_words":358232903,"top_heap_words":444154632,"mean_space_overhead":22.530961},"codesize":955072.0,"ocaml_url":"https://github.com/Sudha247/ocaml-multicore/archive/gc_colours_backport.tar.gz"}
{"name":"yojson_ydump.sample.json","command":"taskset --cpu-list 5 ./ydump.exe -c sample.json","time_secs":0.7880899906158447,"user_time_secs":0.771821,"sys_time_secs":0.015996,"maxrss_kB":11916,"ocaml":{"version":"4.10.0+multicore","c_com
{"name":"finalise.90","command":"taskset --cpu-list 5 ./finalise.exe 90","time_secs":2.037163019180298,"user_time_secs":1.996871,"sys_time_secs":0.040017,"maxrss_kB":53728,"ocaml":{"version":"4.10.0+multicore","c_compiler":"gcc","architecture":"amd64","word_size":"64","system":"linux","stats":"false","function_sections":"true","supports_shared_libraries":"true"},"gc":{"allocated_words":42779715,"minor_words":42779629,"promoted_words":35950105,"major_words":35950191,"minor_collections":205,"major_collections":45,"heap_words":2502656,"top_heap_words":3633152,"mean_space_overhead":46.057468},"codesize":166537.0,"ocaml_url":"https://github.com/Sudha247/ocaml-multicore/archive/mark_stack_overflow.tar.gz"}
{"name":"weakretain.50_10000000","command":"taskset --cpu-list 5 ./weakretain.exe 50 10000000","time_secs":1.5504639148712158,"user_time_secs":1.498131,"sys_time_secs":0.052074,"maxrss_kB":98796,"ocaml":{"version":"4.10.0+multicore","c_compiler":"gcc","architecture":"amd64","word_size":"64","system":"linux","stat
This file has been truncated, but you can view the full file.
git log -n 1
commit 7134bea131cd1cf340250bbcce72bdfddedf6df0
Author: Sudha Parimala <sudharg247@gmail.com>
Date: Tue Oct 27 17:04:50 2020 +0530
overflow
<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[default] no changes from file:///home/sudha/runs/sandmark/dependencies
{"name":"finalise.90","command":"./finalise.exe 90","time_secs":2.0173630714416504,"user_time_secs":1.985198,"sys_time_secs":0.031954,"maxrss_kB":53800,"ocaml":{"version":"4.10.0+multicore","c_compiler":"gcc","architecture":"amd64","word_size":"64","system":"linux","stats":"false","function_sections":"true","supports_shared_libraries":"true"},"gc":{"allocated_words":42779715,"minor_words":42779629,"promoted_words":35950105,"major_words":35950191,"minor_collections":205,"major_collections":45,"heap_words":2502656,"top_heap_words":3633152,"mean_space_overhead":46.057468},"codesize":166537.0,"ocaml_url":"https://github.com/Sudha247/ocaml-multicore/archive/mark_stack_overflow.tar.gz"}
{"name":"weakretain.50_10000000","command":"./weakretain.exe 50 10000000","time_secs":1.551781177520752,"user_time_secs":1.515473,"sys_time_secs":0.035987,"maxrss_kB":98712,"ocaml":{"version":"4.10.0+multicore","c_compiler":"gcc","architecture":"amd64","word_size":"64","system":"linux","stats":"false","function_sections":"true","sup
This file has been truncated, but you can view the full file.
git log -n 1
commit 7134bea131cd1cf340250bbcce72bdfddedf6df0
Author: Sudha Parimala <sudharg247@gmail.com>
Date: Tue Oct 27 17:04:50 2020 +0530
overflow
<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[default] no changes from file:///home/sudha/runs/sandmark/dependencies
{"name":"finalise.90","command":"taskset --cpu-list 5 ./finalise.exe 90","time_secs":1.569916009902954,"user_time_secs":1.545621,"sys_time_secs":0.023963,"maxrss_kB":38168,"ocaml":{"version":"4.13.0+dev0-2020-10-19","c_compiler":"gcc","architecture":"amd64","word_size":"64","system":"linux","function_sections":"true","supports_shared_libraries":"true","linear_magic_number":"Caml1999L029"},"gc":{"allocated_words":42047510,"minor_words":42047510,"promoted_words":35837933,"major_words":35837933,"minor_collections":185,"major_collections":55,"heap_words":2026496,"heap_chunks":17,"top_heap_words":2026496,"compactions":0,"forced_major_collections":4},"codesize":143271.0,"ocaml_url":"https://github.com/ocaml/ocaml/archive/trunk.tar.gz"}
{"name":"weakretain.50_10000000","command":"taskset --cpu-list 5 ./weakretain.exe 50 10000000","time_secs":0.7829501628875732,"user_time_secs":0.734806,"sys_time_secs":0.047922,"maxrss_kB":84284,"ocaml":{"version":"4.13.0+dev0-2020-10-19","c_compiler":"gcc","architecture":"amd64","wo