mirror of
https://gitlab.com/scemama/qmcchem.git
synced 2024-08-29 22:33:41 +02:00
Works with Core 0.10
This commit is contained in:
parent
51e59aff8e
commit
267c1cf9a0
@ -68,7 +68,7 @@ let dir_name = lazy(
|
|||||||
Lazy.force Qputils.ezfio_filename
|
Lazy.force Qputils.ezfio_filename
|
||||||
in
|
in
|
||||||
let md5 =
|
let md5 =
|
||||||
Md5.hash ()
|
QmcMd5.hash ()
|
||||||
in
|
in
|
||||||
List.fold_right ~init:"" ~f:Filename.concat
|
List.fold_right ~init:"" ~f:Filename.concat
|
||||||
[ ezfio_filename ; "blocks" ; md5 ; Filename.dir_sep ]
|
[ ezfio_filename ; "blocks" ; md5 ; Filename.dir_sep ]
|
||||||
@ -142,7 +142,7 @@ let raw_data ?(locked=true) () =
|
|||||||
|
|
||||||
|
|
||||||
let properties = lazy (
|
let properties = lazy (
|
||||||
let set = Set.empty ~comparator:Comparator.Poly.comparator in
|
let set = Set.Poly.empty in
|
||||||
List.fold (raw_data ()) ~init:set ~f:(fun s x -> Set.add s x.property)
|
List.fold (raw_data ()) ~init:set ~f:(fun s x -> Set.add s x.property)
|
||||||
|> Set.to_list
|
|> Set.to_list
|
||||||
)
|
)
|
||||||
|
@ -40,7 +40,7 @@ let create_nodefile () =
|
|||||||
in
|
in
|
||||||
|
|
||||||
let h =
|
let h =
|
||||||
Hashtbl.create ~hashable:String.hashable ~size:1000 ()
|
String.Table.create ~size:1000 ()
|
||||||
in
|
in
|
||||||
|
|
||||||
let in_channel =
|
let in_channel =
|
||||||
|
@ -59,10 +59,12 @@ let run ?(daemon=true) ezfio_filename =
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(*
|
||||||
(** Maximum size of the blocks file before compressing *)
|
(** Maximum size of the blocks file before compressing *)
|
||||||
let max_file_size = ref (
|
let max_file_size = ref (
|
||||||
Byte_units.create `Kilobytes 64.)
|
Byte_units.create `Kilobytes 64.)
|
||||||
in
|
in
|
||||||
|
*)
|
||||||
|
|
||||||
|
|
||||||
let hostname =
|
let hostname =
|
||||||
@ -781,6 +783,7 @@ let run ?(daemon=true) ezfio_filename =
|
|||||||
| _ ->
|
| _ ->
|
||||||
begin
|
begin
|
||||||
Out_channel.flush !block_channel ;
|
Out_channel.flush !block_channel ;
|
||||||
|
(*
|
||||||
let file_size =
|
let file_size =
|
||||||
(Unix.stat block_channel_filename_locked).Unix.st_size
|
(Unix.stat block_channel_filename_locked).Unix.st_size
|
||||||
|> Float.of_int64
|
|> Float.of_int64
|
||||||
@ -791,6 +794,7 @@ let run ?(daemon=true) ezfio_filename =
|
|||||||
compress_block_file ();
|
compress_block_file ();
|
||||||
max_file_size := Byte_units.scale file_size 1.2;
|
max_file_size := Byte_units.scale file_size 1.2;
|
||||||
end
|
end
|
||||||
|
*)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
done;
|
done;
|
||||||
|
@ -74,7 +74,7 @@ let spec =
|
|||||||
|
|
||||||
|
|
||||||
let command =
|
let command =
|
||||||
Command.basic
|
Command.basic_spec
|
||||||
~summary: "Debug ZeroMQ communications"
|
~summary: "Debug ZeroMQ communications"
|
||||||
~readme:(fun () -> "Gets debug information from the ZMQ debug sockets.")
|
~readme:(fun () -> "Gets debug information from the ZMQ debug sockets.")
|
||||||
spec
|
spec
|
||||||
|
@ -95,10 +95,10 @@ let create_temp_file ?temp_filename ezfio_filename fields =
|
|||||||
(** Write the input file corresponding to the MD5 key *)
|
(** Write the input file corresponding to the MD5 key *)
|
||||||
let write_input_in_ezfio ezfio_filename fields =
|
let write_input_in_ezfio ezfio_filename fields =
|
||||||
let dirname =
|
let dirname =
|
||||||
Lazy.force Md5.input_directory
|
Lazy.force QmcMd5.input_directory
|
||||||
in
|
in
|
||||||
let temp_filename =
|
let temp_filename =
|
||||||
Md5.hash ()
|
QmcMd5.hash ()
|
||||||
|> Filename.concat dirname
|
|> Filename.concat dirname
|
||||||
in
|
in
|
||||||
let input_filename =
|
let input_filename =
|
||||||
@ -246,7 +246,7 @@ let run ~c ?f ?t ?l ?m ?e ?et ?s ?ts ?w ?wt ?n ?j ?p ?input ezfio_filename =
|
|||||||
if c then
|
if c then
|
||||||
begin
|
begin
|
||||||
let dirname =
|
let dirname =
|
||||||
Filename.concat (Filename.concat ezfio_filename "blocks") (Md5.hash ())
|
Filename.concat (Filename.concat ezfio_filename "blocks") (QmcMd5.hash ())
|
||||||
in
|
in
|
||||||
let rec clean_dir y =
|
let rec clean_dir y =
|
||||||
match Sys.is_directory y with
|
match Sys.is_directory y with
|
||||||
@ -268,7 +268,7 @@ let run ~c ?f ?t ?l ?m ?e ?et ?s ?ts ?w ?wt ?n ?j ?p ?input ezfio_filename =
|
|||||||
;
|
;
|
||||||
|
|
||||||
Input.validate ();
|
Input.validate ();
|
||||||
Md5.reset_hash ();
|
QmcMd5.reset_hash ();
|
||||||
write_input_in_ezfio ezfio_filename fields
|
write_input_in_ezfio ezfio_filename fields
|
||||||
|
|
||||||
|
|
||||||
@ -308,7 +308,7 @@ let spec =
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
let command =
|
let command =
|
||||||
Command.basic
|
Command.basic_spec
|
||||||
~summary: "Edit input data"
|
~summary: "Edit input data"
|
||||||
~readme:(fun () ->
|
~readme:(fun () ->
|
||||||
"
|
"
|
||||||
|
@ -20,7 +20,7 @@ let bind_socket ~socket_type ~socket ~address =
|
|||||||
let run ezfio_filename dataserver =
|
let run ezfio_filename dataserver =
|
||||||
|
|
||||||
let dataserver_address, dataserver_port =
|
let dataserver_address, dataserver_port =
|
||||||
Substring.create ~pos:6 dataserver
|
Substring.create ~pos:6 (Bytes.of_string dataserver)
|
||||||
|> Substring.to_string
|
|> Substring.to_string
|
||||||
|> String.lsplit2_exn ~on:':'
|
|> String.lsplit2_exn ~on:':'
|
||||||
and qmc =
|
and qmc =
|
||||||
|
@ -20,7 +20,7 @@ let spec =
|
|||||||
+> anon ("ezfio_file" %: string)
|
+> anon ("ezfio_file" %: string)
|
||||||
|
|
||||||
let command =
|
let command =
|
||||||
Command.basic
|
Command.basic_spec
|
||||||
~summary: "Display info on an EZFIO database"
|
~summary: "Display info on an EZFIO database"
|
||||||
~readme:(fun () ->
|
~readme:(fun () ->
|
||||||
"
|
"
|
||||||
|
@ -5,13 +5,13 @@ let run ?c ?d ~l ~update ezfio_filename =
|
|||||||
Qputils.set_ezfio_filename ezfio_filename;
|
Qputils.set_ezfio_filename ezfio_filename;
|
||||||
|
|
||||||
let input_directory =
|
let input_directory =
|
||||||
Lazy.force Md5.input_directory
|
Lazy.force QmcMd5.input_directory
|
||||||
in
|
in
|
||||||
|
|
||||||
let handle_options () =
|
let handle_options () =
|
||||||
|
|
||||||
let current_md5 =
|
let current_md5 =
|
||||||
Md5.hash ()
|
QmcMd5.hash ()
|
||||||
in
|
in
|
||||||
|
|
||||||
let filename_of_key key =
|
let filename_of_key key =
|
||||||
@ -30,9 +30,9 @@ let run ?c ?d ~l ~update ezfio_filename =
|
|||||||
Printf.printf "Updating\n%!" ;
|
Printf.printf "Updating\n%!" ;
|
||||||
let update_one old_key =
|
let update_one old_key =
|
||||||
Qmcchem_edit.run ~c:false ~input:(filename_of_key old_key) ezfio_filename;
|
Qmcchem_edit.run ~c:false ~input:(filename_of_key old_key) ezfio_filename;
|
||||||
Md5.reset_hash ();
|
QmcMd5.reset_hash ();
|
||||||
let new_key =
|
let new_key =
|
||||||
Md5.hash ()
|
QmcMd5.hash ()
|
||||||
in
|
in
|
||||||
|
|
||||||
if (old_key <> new_key) then
|
if (old_key <> new_key) then
|
||||||
@ -118,7 +118,7 @@ let run ?c ?d ~l ~update ezfio_filename =
|
|||||||
|
|
||||||
match (c,d,l,update) with
|
match (c,d,l,update) with
|
||||||
| (None,None,false,false) ->
|
| (None,None,false,false) ->
|
||||||
Printf.printf "Current key :\n%s\n" (Md5.hash ())
|
Printf.printf "Current key :\n%s\n" (QmcMd5.hash ())
|
||||||
| _ -> handle_options ()
|
| _ -> handle_options ()
|
||||||
|
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ let spec =
|
|||||||
|
|
||||||
|
|
||||||
let command =
|
let command =
|
||||||
Command.basic
|
Command.basic_spec
|
||||||
~summary: "Manipulate input MD5 keys"
|
~summary: "Manipulate input MD5 keys"
|
||||||
~readme:(fun () ->
|
~readme:(fun () ->
|
||||||
"
|
"
|
||||||
|
@ -258,7 +258,7 @@ let spec =
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
let command =
|
let command =
|
||||||
Command.basic
|
Command.basic_spec
|
||||||
~summary: "Displays the results computed in an EZFIO directory."
|
~summary: "Displays the results computed in an EZFIO directory."
|
||||||
~readme:(fun () -> "Displays the results computed in an EZFIO directory.")
|
~readme:(fun () -> "Displays the results computed in an EZFIO directory.")
|
||||||
spec
|
spec
|
||||||
|
@ -204,7 +204,7 @@ let spec =
|
|||||||
|
|
||||||
|
|
||||||
let command =
|
let command =
|
||||||
Command.basic
|
Command.basic_spec
|
||||||
~summary: "Run a calculation"
|
~summary: "Run a calculation"
|
||||||
~readme:(fun () ->
|
~readme:(fun () ->
|
||||||
"
|
"
|
||||||
|
@ -12,7 +12,7 @@ let spec =
|
|||||||
+> anon ("ezfio_file" %: string)
|
+> anon ("ezfio_file" %: string)
|
||||||
|
|
||||||
let command =
|
let command =
|
||||||
Command.basic
|
Command.basic_spec
|
||||||
~summary: "Stop a running calculation"
|
~summary: "Stop a running calculation"
|
||||||
~readme:(fun () ->
|
~readme:(fun () ->
|
||||||
"
|
"
|
||||||
|
@ -344,10 +344,10 @@ let max_block =
|
|||||||
|
|
||||||
|
|
||||||
(** Create a hash table for merging *)
|
(** Create a hash table for merging *)
|
||||||
let create_hash ~hashable ~create_key ?(update_block_id=(fun x->x))
|
let create_hash ~create_key ?(update_block_id=(fun x->x))
|
||||||
?(update_value=(fun wc vc wb vb sw -> (wc *. vc +. wb *. vb) /. sw) )
|
?(update_value=(fun wc vc wb vb sw -> (wc *. vc +. wb *. vb) /. sw) )
|
||||||
?(update_weight=(fun wc wb -> wc +. wb) ) t =
|
?(update_weight=(fun wc wb -> wc +. wb) ) t =
|
||||||
let table = Hashtbl.create ~hashable:hashable ()
|
let table = String.Table.create ()
|
||||||
in
|
in
|
||||||
List.iter t.data ~f:(fun block ->
|
List.iter t.data ~f:(fun block ->
|
||||||
let key = create_key block
|
let key = create_key block
|
||||||
@ -405,8 +405,8 @@ let create_hash ~hashable ~create_key ?(update_block_id=(fun x->x))
|
|||||||
|
|
||||||
|
|
||||||
(** Genergic merge function *)
|
(** Genergic merge function *)
|
||||||
let merge ~hashable ~create_key ?update_block_id ?update_value ?update_weight t =
|
let merge ~create_key ?update_block_id ?update_value ?update_weight t =
|
||||||
let table = create_hash ~hashable ~create_key ?update_block_id ?update_value ?update_weight t
|
let table = create_hash ~create_key ?update_block_id ?update_value ?update_weight t
|
||||||
in
|
in
|
||||||
{ property = t.property ;
|
{ property = t.property ;
|
||||||
data = Hashtbl.to_alist table
|
data = Hashtbl.to_alist table
|
||||||
@ -422,14 +422,12 @@ let merge ~hashable ~create_key ?update_block_id ?update_value ?update_weight t
|
|||||||
(** Merge per block id *)
|
(** Merge per block id *)
|
||||||
let merge_per_block_id =
|
let merge_per_block_id =
|
||||||
merge
|
merge
|
||||||
~hashable:Int.hashable
|
~create_key:(fun block -> Block_id.to_string block.Block.block_id)
|
||||||
~create_key:(fun block -> Block_id.to_int block.Block.block_id)
|
|
||||||
|
|
||||||
|
|
||||||
(** Merge per compute_node *)
|
(** Merge per compute_node *)
|
||||||
let merge_per_compute_node =
|
let merge_per_compute_node =
|
||||||
merge
|
merge
|
||||||
~hashable:String.hashable
|
|
||||||
~create_key:(fun block ->
|
~create_key:(fun block ->
|
||||||
Printf.sprintf "%s"
|
Printf.sprintf "%s"
|
||||||
(Compute_node.to_string block.Block.compute_node) )
|
(Compute_node.to_string block.Block.compute_node) )
|
||||||
@ -439,7 +437,6 @@ let merge_per_compute_node =
|
|||||||
(** Merge per Compute_node and PID *)
|
(** Merge per Compute_node and PID *)
|
||||||
let merge_per_compute_node_and_pid =
|
let merge_per_compute_node_and_pid =
|
||||||
merge
|
merge
|
||||||
~hashable:String.hashable
|
|
||||||
~create_key:(fun block ->
|
~create_key:(fun block ->
|
||||||
Printf.sprintf "%s %10.10d"
|
Printf.sprintf "%s %10.10d"
|
||||||
(Compute_node.to_string block.Block.compute_node)
|
(Compute_node.to_string block.Block.compute_node)
|
||||||
@ -450,7 +447,6 @@ let merge_per_compute_node_and_pid =
|
|||||||
(** Merge per Compute_node and BlockId *)
|
(** Merge per Compute_node and BlockId *)
|
||||||
let merge_per_compute_node_and_block_id =
|
let merge_per_compute_node_and_block_id =
|
||||||
merge
|
merge
|
||||||
~hashable:String.hashable
|
|
||||||
~create_key:(fun block ->
|
~create_key:(fun block ->
|
||||||
Printf.sprintf "%s %10.10d"
|
Printf.sprintf "%s %10.10d"
|
||||||
(Compute_node.to_string block.Block.compute_node)
|
(Compute_node.to_string block.Block.compute_node)
|
||||||
@ -481,7 +477,6 @@ let ( /@ ) p f = one_variable_operator p f
|
|||||||
let two_variable_operator ~update_value p1 p2 =
|
let two_variable_operator ~update_value p1 p2 =
|
||||||
merge
|
merge
|
||||||
~update_value
|
~update_value
|
||||||
~hashable:String.hashable
|
|
||||||
~create_key:(fun block ->
|
~create_key:(fun block ->
|
||||||
Printf.sprintf "%s %10.10d %10.10d"
|
Printf.sprintf "%s %10.10d %10.10d"
|
||||||
(Compute_node.to_string block.Block.compute_node)
|
(Compute_node.to_string block.Block.compute_node)
|
||||||
@ -509,7 +504,6 @@ let ( /! ) = two_variable_operator
|
|||||||
(** Merge two consecutive blocks *)
|
(** Merge two consecutive blocks *)
|
||||||
let compress =
|
let compress =
|
||||||
merge
|
merge
|
||||||
~hashable:String.hashable
|
|
||||||
~create_key:(fun block ->
|
~create_key:(fun block ->
|
||||||
Printf.sprintf "%s %10.10d" (Compute_node.to_string block.Block.compute_node)
|
Printf.sprintf "%s %10.10d" (Compute_node.to_string block.Block.compute_node)
|
||||||
(((Block_id.to_int block.Block.block_id)+1)/2))
|
(((Block_id.to_int block.Block.block_id)+1)/2))
|
||||||
@ -522,7 +516,7 @@ let compress =
|
|||||||
|
|
||||||
(** Last value on each compute node (for wall_time) *)
|
(** Last value on each compute node (for wall_time) *)
|
||||||
let max_value_per_compute_node t =
|
let max_value_per_compute_node t =
|
||||||
let table = Hashtbl.create ~hashable:String.hashable ()
|
let table = String.Table.create ()
|
||||||
in
|
in
|
||||||
let create_key block =
|
let create_key block =
|
||||||
Printf.sprintf "%s %10.10d"
|
Printf.sprintf "%s %10.10d"
|
||||||
|
Loading…
Reference in New Issue
Block a user