mirror of
https://gitlab.com/scemama/qmcchem.git
synced 2024-12-22 04:13:31 +01:00
Working on binary I/O
This commit is contained in:
parent
dfbbf8b329
commit
ca7f0f0171
@ -120,6 +120,10 @@ let of_bytes b =
|
|||||||
|
|
||||||
|
|
||||||
let to_string b =
|
let to_string b =
|
||||||
|
if Qmcchem_config.binary_io then
|
||||||
|
to_bytes b
|
||||||
|
|> Bytes.to_string
|
||||||
|
else
|
||||||
Printf.sprintf "%s %s # %s %s %s %d"
|
Printf.sprintf "%s %s # %s %s %s %d"
|
||||||
(Sample.to_string b.value )
|
(Sample.to_string b.value )
|
||||||
(Weight.to_float b.weight |> string_of_float)
|
(Weight.to_float b.weight |> string_of_float)
|
||||||
|
@ -115,3 +115,5 @@ let ip_address = lazy (
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
let binary_io = false
|
||||||
|
|
||||||
|
@ -758,6 +758,7 @@ let run ?(daemon=true) ezfio_filename =
|
|||||||
| Some wall ->
|
| Some wall ->
|
||||||
begin
|
begin
|
||||||
output_string !block_channel (Block.to_string wall);
|
output_string !block_channel (Block.to_string wall);
|
||||||
|
if not Qmcchem_config.binary_io then
|
||||||
output_char !block_channel '\n';
|
output_char !block_channel '\n';
|
||||||
end
|
end
|
||||||
| _ -> ()
|
| _ -> ()
|
||||||
@ -767,6 +768,7 @@ let run ?(daemon=true) ezfio_filename =
|
|||||||
if (status = Status.Running) then
|
if (status = Status.Running) then
|
||||||
touch_worker b.Block.compute_node b.Block.pid ;
|
touch_worker b.Block.compute_node b.Block.pid ;
|
||||||
output_string !block_channel (Block.to_string b);
|
output_string !block_channel (Block.to_string b);
|
||||||
|
if not Qmcchem_config.binary_io then
|
||||||
output_char !block_channel '\n';
|
output_char !block_channel '\n';
|
||||||
recv_log (Block.to_string b)
|
recv_log (Block.to_string b)
|
||||||
end
|
end
|
||||||
|
@ -344,7 +344,7 @@ let create_ezfio_handler () =
|
|||||||
let lines =
|
let lines =
|
||||||
input_lines "ezfio.ml"
|
input_lines "ezfio.ml"
|
||||||
(* /!\ Change when ezfio.ml changes *)
|
(* /!\ Change when ezfio.ml changes *)
|
||||||
|> List.mapi (fun i l -> if i > 444 then Some l else None)
|
|> List.mapi (fun i l -> if i > 442 then Some l else None)
|
||||||
|> List.filter (fun x -> x <> None)
|
|> List.filter (fun x -> x <> None)
|
||||||
|> List.map (fun x ->
|
|> List.map (fun x ->
|
||||||
match x with
|
match x with
|
||||||
|
@ -146,6 +146,10 @@ for p in properties_qmcvar:
|
|||||||
print >>file, """| %(P)s -> "%(P)s" """%{'P':p[1].capitalize(), 'p':p[1]}
|
print >>file, """| %(P)s -> "%(P)s" """%{'P':p[1].capitalize(), 'p':p[1]}
|
||||||
print >>file, """;;
|
print >>file, """;;
|
||||||
|
|
||||||
|
let of_bytes x =
|
||||||
|
Bytes.to_string x
|
||||||
|
|> of_string
|
||||||
|
|
||||||
let to_bytes x =
|
let to_bytes x =
|
||||||
to_string x
|
to_string x
|
||||||
|> Bytes.of_string
|
|> Bytes.of_string
|
||||||
|
Loading…
Reference in New Issue
Block a user