Commit f2743200 authored by Benoit Barbot's avatar Benoit Barbot
Browse files

improve memory usage

parent 93f69231
Pipeline #1697 passed with stages
in 32 seconds
......@@ -302,11 +302,17 @@ module Make (Bt: ZoneGraphInput.BoundType) (P: WeightStructure) = struct
(fun _ -> Array.iter (fun x -> Format.fprintf f "%f @ " x)) tab
let eval_poly_state ?smp (id,tab) p=
let j,p = Array.fold_left
let p2 = ref p in
for i = 0 to Array.length tab -1 do
p2 := apply_const ?smp !p2 (var_of_int (i+1)) (F.of_float tab.(i))
done;
(* let _,p = Array.fold_left
(fun (i,pit) v ->
i+1,apply_const ?smp pit (var_of_int i) (F.of_float v))
(1, p) tab in
p(*apply_const p (var_of_int j) (1.0/.smp)*)
p(*apply_const p (var_of_int j) (1.0/.smp)*)*)
!p2
let eval_poly_state_full ?smp (_,tab) p=
P.apply_all ?smp p tab
(* match to_float @@ eval_poly_state state p with
......
......@@ -32,7 +32,7 @@ module Make (FunIt:Semantic.S) (Param:sig val smp: float option end) =struct
~samplers:((fun j -> Low_disc_sampler.random j i),(fun j -> sampler j i))
rgpoly template_word;
if store_traj then OF.print_traj outfile;
fprintf outfile "@."
if out_style <> Void then fprintf outfile "@."
done with
FunIt.Deadlock(st) -> if print_bar then printf "]@.";
eprintf "A deadlock occured in state: %a@." FunIt.print_state st;
......
......@@ -143,6 +143,7 @@ let _ =
Some x
in
Gc.compact ();
let module M = MainLoop.Make(FunIt) (struct let smp=smp end) in
(* Sampling *)
......
......@@ -30,16 +30,16 @@ let build_interface_elem up (opt,x,help) =
let build_cmd l =
(Arguments.build_cmd l)^" automata.prism"
let autocompute = ref true
let only_parse = ref false
let build_interface ?(class_="") ?(stop=(fun () -> ())) up l =
let cmd,cmdup = kbd' (build_cmd l) in
let up2 () =
cmdup (build_cmd l);
if !autocompute then up true else up false in
if not !only_parse then up true else up false in
let elemlist = List.map (build_interface_elem up2) l in
let bottom = [button ~on_click:(fun _ -> up true) [text "Compute"] ; (*button ~on_click:(fun _ -> stop ()) [text "Stop"];*)
text " autocompute: " ;
checkbox_input ~on_change:(fun x -> autocompute:=x;up2 ()) !autocompute ] in
checkbox_input ~on_change:(fun x -> only_parse:= not x;up2 ()) (not !only_parse) ] in
div ~class_ (text "arguments : " :: elemlist @ ( br () :: cmd :: br () :: bottom ) )
......@@ -130,7 +130,7 @@ let _ = run @@ fun () ->
Buffer.clear buffstd;
Buffer.clear buffdata;
let cmd =
Arguments.spec_short @ ["--autocompute",Arguments.Bool autocompute,""]
Arguments.spec_short @ ["--only-parse",Arguments.Bool (ref b),""]
|> build_cmd
|> String.escaped in
worker##postMessage( (cmd, !file_content) ) in
......
......@@ -105,7 +105,7 @@ let main cmd ta out_formatter =
|> Scanf.unescaped
|> String.split_on_char ' '
|> Array.of_list in
Arg.parse_argv argv (("--autocompute",Arg.Clear only_parse,"")::spec_caml_arg) (fun _ -> ()) usage_str;
Arg.parse_argv argv (("--only-parse",Arg.Clear only_parse,"")::spec_caml_arg) (fun _ -> ()) usage_str;
post_parse ();
computation ta out_formatter
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment