Commit b7c71a5b authored by Benoit Barbot's avatar Benoit Barbot

fix bug an currentweight due to last mergeé

parent 8a5c99e5
Pipeline #1045 failed with stages
in 3 minutes and 1 second
......@@ -6,12 +6,12 @@ RUN apt-get install -y --no-install-recommends libexpat-dev libboost-dev libz-de
RUN apt-get install -y --no-install-recommends opam autoconf automake libtool gnuplot-nox cmake
RUN opam init --comp 4.04.2; opam update; eval `opam config env`; opam install camlzip xml-light ocamlfind camlp4
ADD ssh /root/.ssh/
RUN git clone --single-branch -b VanDerCorput git@git.lacl.fr:barbot/Cosmos.git Cosmos
WORKDIR Cosmos
#ADD ssh /root/.ssh/
#RUN git clone --single-branch -b VanDerCorput git@git.lacl.fr:barbot/Cosmos.git Cosmos
#WORKDIR Cosmos
#RUN eval `opam config env`; cmake .; make
RUN eval `opam config env`; autoreconf --install ;./configure --enable-silent-rules CXXFLAGS='-O3'
RUN eval `opam config env`; make ; make install
RUN eval `opam config env`; cd Examples; ocaml bench.ml
\ No newline at end of file
#RUN eval `opam config env`; autoreconf --install ;./configure --enable-silent-rules CXXFLAGS='-O3'
#RUN eval `opam config env`; make ; make install
#RUN eval `opam config env`; cd Examples; ocaml bench.ml
\ No newline at end of file
......@@ -37,9 +37,11 @@ void generateEvent(double ctime,Event& E,size_t Id,const abstractBinding& b,time
case SYNC:
case DISCRETEUSERDEFINE:
N.ParamDistr[0]= N.GetWeight(Id,b);
w = TG.GenerateTime(EXPONENTIAL, Id, N.ParamDistr, N.customDistr);
w = TG.current_weight + TG.GenerateTime(EXPONENTIAL, Id, N.ParamDistr, N.customDistr);
if(P.verbose>4){
cerr << "weight : "<< N.ParamDistr[0] << endl;
cerr << TG.string_of_dist(EXPONENTIAL, N.ParamDistr, N.customDistr);
cerr << endl;
}
break;
case PARETO:
......
......@@ -3,17 +3,17 @@ open Printf
#load "unix.cma"
#load "str.cma"
let uni f =
let uni f =
let v = ref None in
function () -> match !v with
Some x -> x
| None -> let v2 = f () in
v := Some v2;
v2
v := Some v2;
v2
exception CmdFail of int
let cosmos_options = ref (
let cosmos_options = ref (
try
let _ = Sys.getenv "COV" in
" --gppflags \"--coverage -Wno-return-type\" --gppcmd clang++"
......@@ -21,14 +21,14 @@ let cosmos_options = ref (
(*let cosmos_path = (Sys.getcwd ())^"/../../bin/Cosmos"*)
let cosmos_path = ref (try
let cp = Sys.getenv "COSMOS" in
let cp = Sys.getenv "COSMOS" in
(*cosmos_options := !cosmos_options^" --bin-path ../../src/Simulator/bin "; *)
cp
with Not_found -> "../../bin/Cosmos");;
(*" --gppflags --coverage --gppcmd clang++"
(*" --gppflags --coverage --gppcmd clang++"
let _ = Sys.getenv "COV" in " --gppflags --coverage --gppcmd clang++"
*)
......@@ -59,7 +59,7 @@ let dummy_haslr = {
mean =0.;
stdDev =0.;
confInterval = 0.,0. ;
minmax = 0.0 , 0.0
minmax = 0.0 , 0.0
}
let init_log s =
......@@ -71,7 +71,7 @@ let init_log s =
let update_log b (s:string) =
if Array.length Sys.argv >2 then
try
try
let fl = Sys.argv.(2) in(* Unix.getenv "COSMOS_TEST_LOG" in*)
let fs = open_in fl in
let (success,failure) = input_value fs in
......@@ -90,29 +90,32 @@ let read_log s =
close_in fs;
(succ,fail);;
let rec check_result l = function
| [] -> true
| (lab,v)::q -> try
let h = List.assoc lab l in
if v >= (fst h.confInterval) -. 0.00001 && (snd h.confInterval) +. 0.00001 >= v && ((snd h.confInterval) -. (fst h.confInterval) < 1000.0) then check_result l q
else false
| (lab,v)::q -> try
let h = List.assoc lab l in
if v >= (fst h.confInterval) -. 0.00001 && (snd h.confInterval) +. 0.00001 >= v && ((snd h.confInterval) -. (fst h.confInterval) < 1000.0) then check_result l q
else false
with x -> false
let check_unique_result [lab1,h] [lab2,v] =
if v < fst h.confInterval then (-1)
else if v > snd h.confInterval then 1
else 0
let check_unique_result r1 r2 =
match (r1,r2) with
([lab1,h],[lab2,v]) ->
if v < fst h.confInterval then (-1)
else if v > snd h.confInterval then 1
else 0
| _ -> 0
let rec print_readable l = function
| [] -> ""
| (lab,v)::q -> try
let h = List.assoc lab l in
if v >= (fst h.confInterval) -. 0.00001 && (snd h.confInterval) +. 0.00001 >= v then (
Printf.sprintf "%s: Value %e is inside confidence interval [%e,%e]\n%s" lab v (fst h.confInterval) (snd h.confInterval) (print_readable l q)
) else (
Printf.sprintf "%s: Value %e is outside confidence interval [%e,%e]\n%s" lab v (fst h.confInterval) (snd h.confInterval) (print_readable l q)
)
| (lab,v)::q -> try
let h = List.assoc lab l in
if v >= (fst h.confInterval) -. 0.00001 && (snd h.confInterval) +. 0.00001 >= v then (
Printf.sprintf "%s: Value %e is inside confidence interval [%e,%e]\n%s" lab v (fst h.confInterval) (snd h.confInterval) (print_readable l q)
) else (
Printf.sprintf "%s: Value %e is outside confidence interval [%e,%e]\n%s" lab v (fst h.confInterval) (snd h.confInterval) (print_readable l q)
)
with _ -> print_readable l q
type result = {
......@@ -175,16 +178,16 @@ let parse_result f =
let ls = split_delim dots str in
match ls with
| "Prism Result" :: v :: [] -> let x = float_of_string v in
(snd (List.hd result.haslResult)).mean <- x;
(snd (List.hd result.haslResult)).confInterval <- (x-.0.0001 , x+. 0.0001)
(snd (List.hd result.haslResult)).mean <- x;
(snd (List.hd result.haslResult)).confInterval <- (x-.0.0001 , x+. 0.0001)
| "Estimated value" :: v :: [] -> (snd (List.hd result.haslResult)).mean <- (float_of_string v)
| "Standard deviation" :: v :: [] -> (snd (List.hd result.haslResult)).stdDev <- (float_of_string v)
| "Confidence level" :: v :: [] -> result.conflevel <- (float_of_string v)
| "Confidence level" :: v :: [] -> result.conflevel <- (float_of_string v)
| "Confidence interval" :: v :: [] ->
(match split confintdel v with
| a::b::_ -> (snd (List.hd result.haslResult)).confInterval <- (float_of_string a , float_of_string b)
| _ -> printf "Fail to parse confidence interval %s\n" v)
| "Minimal and maximal value" :: v :: [] ->
| "Minimal and maximal value" :: v :: [] ->
(match split confintdel v with
| a::b::_ -> (snd (List.hd result.haslResult)).minmax <- (float_of_string a , float_of_string b)
| _ -> printf "Fail to parse minmax %s\n" v)
......@@ -193,40 +196,40 @@ let parse_result f =
| a::b::_ -> (snd (List.hd result.haslResult)).confInterval <- (float_of_string a , float_of_string b)
| _ -> printf "Fail to parse confidence interval %s\n" v)
| "Time for simulation" :: v :: [] ->
let v2 = String.sub v 0 (String.length v -1) in
result.simtime <- (float_of_string v2)
| "Time for simulation" :: v :: [] ->
let v2 = String.sub v 0 (String.length v -1) in
result.simtime <- (float_of_string v2)
| "Seed" :: v:: [] -> ()
| "Command line" :: v :: [] -> ()
| "Total CPU time" :: v :: [] -> result.systime <- (float_of_string v)
| "Total Memory used" :: v :: [] ->
result.memory <- (float_of_string (String.sub v 0 ((String.length v) -3)))
| "Total paths" :: v :: [] -> result.nbRun <- (int_of_string v)
| "Accepted paths" :: v :: [] -> result.nbSuccRun <- (int_of_string v)
| "Number of jobs" :: v :: [] -> result.nbJob <- (int_of_string v)
| "Batch size" :: v :: [] -> result.batch <- (int_of_string v)
| "Width" :: v :: [] -> ()
| "Model path" :: v :: [] -> result.modelName <- v;
| "LHA path" :: v :: [] -> result.propName <- v;
| "Formula" :: v :: [] -> result.propName <- v;
| "LHA loop" :: v :: "transient" :: w :: [] -> result.propName <- ("loop"^v^"transient"^w);
| s1 :: [""] -> result.haslResult <- (s1,{dummy_haslr with mean=0.0}):: result.haslResult
| "Level" :: v :: [] -> ()
| "Method" :: _ ->()
| "LHA loop" :: _ -> ()
| "Total CPU time" :: v :: [] -> result.systime <- (float_of_string v)
| "Total Memory used" :: v :: [] ->
result.memory <- (float_of_string (String.sub v 0 ((String.length v) -3)))
| "Total paths" :: v :: [] -> result.nbRun <- (int_of_string v)
| "Accepted paths" :: v :: [] -> result.nbSuccRun <- (int_of_string v)
| "Number of jobs" :: v :: [] -> result.nbJob <- (int_of_string v)
| "Batch size" :: v :: [] -> result.batch <- (int_of_string v)
| "Width" :: v :: [] -> ()
| "Model path" :: v :: [] -> result.modelName <- v;
| "LHA path" :: v :: [] -> result.propName <- v;
| "Formula" :: v :: [] -> result.propName <- v;
| "LHA loop" :: v :: "transient" :: w :: [] -> result.propName <- ("loop"^v^"transient"^w);
| s1 :: [""] -> result.haslResult <- (s1,{dummy_haslr with mean=0.0}):: result.haslResult
| "Level" :: v :: [] -> ()
| "Method" :: _ ->()
| "LHA loop" :: _ -> ()
| "Command line" :: _ -> ()
| "Seed" :: _ -> ()
| _ -> print_endline ("Fail to parse'"^str^"'")
| _ -> print_endline ("Fail to parse'"^str^"'")
done
with
| End_of_file -> close_in fs
| x -> print_endline "fail to parse"; raise x
);
);
result;;
let string_date () =
let tm = Unix.localtime (Unix.gettimeofday ()) in
Printf.sprintf "%i/%i/%i %i:%i:%i" tm.Unix.tm_mday tm.Unix.tm_mon
Printf.sprintf "%i/%i/%i %i:%i:%i" tm.Unix.tm_mday tm.Unix.tm_mon
(tm.Unix.tm_year+1900) tm.Unix.tm_hour tm.Unix.tm_min tm.Unix.tm_sec
let exec_cosmos model prop opt printcmd =
......@@ -248,11 +251,11 @@ let test_cosmosBash testname model prop opt v =
try let result = exec_cosmos model prop opt true in
if check_result result.haslResult v
then (
update_log true testname;
print_color (sprintf "testFinished: %s\n%s" testname (print_readable result.haslResult v)) 32
) else (
update_log false testname;
print_color (sprintf "testFailed: %s\n%s" testname (print_readable result.haslResult v)) 31
update_log true testname;
print_color (sprintf "testFinished: %s\n%s" testname (print_readable result.haslResult v)) 32
) else (
update_log false testname;
print_color (sprintf "testFailed: %s\n%s" testname (print_readable result.haslResult v)) 31
)
with CmdFail(ret) ->
update_log false testname;
......@@ -286,22 +289,22 @@ let test_coverage_full name model prop level v o n =
let test_coverage name level v o n =
test_coverage_full name (name^".gspn") (name^".lha") v o n
let execCosmosLog_free resultFile csvFile (name,model,prop,option,prefix) =
try
let r =
let r =
(if prefix then (
let cwd = (Sys.getcwd ())^"/" in
ignore (Sys.command ("mkdir -p "^name));
let cwd = (Sys.getcwd ())^"/" in
ignore (Sys.command ("mkdir -p "^name));
ignore (Sys.command ("lumpingfun.cpp "^name^"/lumpingfun.cpp"));
Sys.chdir name;
let r2 = try exec_cosmos (cwd^model) (cwd^prop) option true
with x -> Sys.chdir cwd; raise x in
Sys.chdir cwd; r2
Sys.chdir name;
let r2 = try exec_cosmos (cwd^model) (cwd^prop) option true
with x -> Sys.chdir cwd; raise x in
Sys.chdir cwd; r2
) else (
let r2 = exec_cosmos model prop option true in
ignore (Sys.command (sprintf "mv Result.res %s.res" name)); r2
let r2 = exec_cosmos model prop option true in
ignore (Sys.command (sprintf "mv Result.res %s.res" name)); r2
)) in
output_value resultFile (name,r);
print_result csvFile "," name r;
......@@ -324,17 +327,15 @@ let csv = uni (fun () -> openCreate "csvResultFile" (fun f->(
let execSavedCosmos ?(prefix=false) x = execSavedCosmos_free prefix (rf ()) (csv ()) x
let printHeadCsv () =
let printHeadCsv () =
print_header (csv ()) ",";;
let producelog resultFile =
let rf = open_in resultFile in (
try while true do
let (n,v) = input_value rf in
print_result stdout ",\t" n v;
try while true do
let (n,v) = input_value rf in
print_result stdout ",\t" n v;
done with
End_of_file -> ()
End_of_file -> ()
);
close_in rf
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