mirror of
https://gitlab.com/scemama/qmcchem.git
synced 2024-12-21 11:53:30 +01:00
atexit
This commit is contained in:
parent
b12ac1be79
commit
dcd4e923d4
@ -154,6 +154,9 @@ let run ezfio_filename dataserver =
|
|||||||
Printf.sprintf "ipc://%s:%d" Qmcchem_config.dev_shm (port+1);
|
Printf.sprintf "ipc://%s:%d" Qmcchem_config.dev_shm (port+1);
|
||||||
in
|
in
|
||||||
bind_socket "PUB" pub_socket address;
|
bind_socket "PUB" pub_socket address;
|
||||||
|
at_exit (fun () ->
|
||||||
|
Sys.remove (Printf.sprintf "%s:%d" Qmcchem_config.dev_shm (port+1))
|
||||||
|
);
|
||||||
|
|
||||||
let sub_socket =
|
let sub_socket =
|
||||||
Zmq.Socket.create zmq_context Zmq.Socket.sub
|
Zmq.Socket.create zmq_context Zmq.Socket.sub
|
||||||
@ -200,6 +203,9 @@ let run ezfio_filename dataserver =
|
|||||||
Printf.sprintf "ipc://%s:%d" Qmcchem_config.dev_shm (port+3);
|
Printf.sprintf "ipc://%s:%d" Qmcchem_config.dev_shm (port+3);
|
||||||
in
|
in
|
||||||
bind_socket "XSUB" sub_socket address;
|
bind_socket "XSUB" sub_socket address;
|
||||||
|
at_exit (fun () ->
|
||||||
|
Sys.remove (Printf.sprintf "%s:%d" Qmcchem_config.dev_shm (port+3))
|
||||||
|
);
|
||||||
|
|
||||||
let pub_socket =
|
let pub_socket =
|
||||||
Zmq.Socket.create zmq_context Zmq.Socket.xpub
|
Zmq.Socket.create zmq_context Zmq.Socket.xpub
|
||||||
@ -367,6 +373,9 @@ let run ezfio_filename dataserver =
|
|||||||
Printf.sprintf "ipc://%s:%d" Qmcchem_config.dev_shm (port);
|
Printf.sprintf "ipc://%s:%d" Qmcchem_config.dev_shm (port);
|
||||||
in
|
in
|
||||||
bind_socket "ROUTER" router_socket address;
|
bind_socket "ROUTER" router_socket address;
|
||||||
|
at_exit (fun () ->
|
||||||
|
Sys.remove (Printf.sprintf "%s:%d" Qmcchem_config.dev_shm port)
|
||||||
|
);
|
||||||
Zmq.Socket.set_receive_high_water_mark router_socket 100000;
|
Zmq.Socket.set_receive_high_water_mark router_socket 100000;
|
||||||
Zmq.Socket.set_send_high_water_mark router_socket 100000;
|
Zmq.Socket.set_send_high_water_mark router_socket 100000;
|
||||||
Zmq.Socket.set_immediate router_socket true;
|
Zmq.Socket.set_immediate router_socket true;
|
||||||
@ -387,6 +396,9 @@ let run ezfio_filename dataserver =
|
|||||||
Printf.sprintf "ipc://%s:%d" Qmcchem_config.dev_shm (port+2);
|
Printf.sprintf "ipc://%s:%d" Qmcchem_config.dev_shm (port+2);
|
||||||
in
|
in
|
||||||
bind_socket "PULL" pull_socket address;
|
bind_socket "PULL" pull_socket address;
|
||||||
|
at_exit (fun () ->
|
||||||
|
Sys.remove (Printf.sprintf "%s:%d" Qmcchem_config.dev_shm (port+2))
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
(* Handles messages coming into the ROUTER socket. *)
|
(* Handles messages coming into the ROUTER socket. *)
|
||||||
|
@ -37,15 +37,18 @@ let to_int = function
|
|||||||
| Stopping -> 3
|
| Stopping -> 3
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
let is_set = ref false
|
||||||
|
|
||||||
let read () =
|
let read () =
|
||||||
Ezfio.set_file (Lazy.force ezfio_filename);
|
if not !is_set then
|
||||||
|
(Ezfio.set_file (Lazy.force ezfio_filename); is_set := true);
|
||||||
Ezfio.get_simulation_do_run ()
|
Ezfio.get_simulation_do_run ()
|
||||||
|> of_int
|
|> of_int
|
||||||
;;
|
;;
|
||||||
|
|
||||||
let write x =
|
let write x =
|
||||||
Ezfio.set_file (Lazy.force ezfio_filename);
|
if not !is_set then
|
||||||
|
(Ezfio.set_file (Lazy.force ezfio_filename); is_set := true);
|
||||||
to_int x
|
to_int x
|
||||||
|> Ezfio.set_simulation_do_run
|
|> Ezfio.set_simulation_do_run
|
||||||
;;
|
;;
|
||||||
|
@ -296,7 +296,7 @@ let input_lines filename =
|
|||||||
let create_ezfio_handler () =
|
let create_ezfio_handler () =
|
||||||
let lines =
|
let lines =
|
||||||
input_lines "ezfio.ml"
|
input_lines "ezfio.ml"
|
||||||
|> List.mapi (fun i l -> if i > 419 then Some l else None)
|
|> List.mapi (fun i l -> if i > 417 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
|
||||||
|
@ -12,7 +12,7 @@ cd ${QMCCHEM_PATH}/src || exit -1
|
|||||||
|
|
||||||
source ${QMCCHEM_PATH}/make.config
|
source ${QMCCHEM_PATH}/make.config
|
||||||
|
|
||||||
LIB="${LIB} ${QMCCHEM_PATH}/lib/libezfio_irp.a ${QMCCHEM_PATH}/lib/libf77zmq.a ${QMCCHEM_PATH}/lib/libzmq.a -lstdc++ -lrt -lz"
|
LIB="${QMCCHEM_PATH}/lib/libezfio_irp.a ${QMCCHEM_PATH}/lib/libf77zmq.a ${QMCCHEM_PATH}/lib/libzmq.a -lstdc++ -lrt -lz ${LIB}"
|
||||||
SRC="${SRC} ZMQ/f77_zmq_module.f90"
|
SRC="${SRC} ZMQ/f77_zmq_module.f90"
|
||||||
OBJ="${OBJ} IRPF90_temp/ZMQ/f77_zmq_module.o"
|
OBJ="${OBJ} IRPF90_temp/ZMQ/f77_zmq_module.o"
|
||||||
INCLUDES="${INCLUDES} -I AO -I SAMPLING -I TOOLS -I JASTROW -I MAIN -I PROPERTIES -I ZMQ"
|
INCLUDES="${INCLUDES} -I AO -I SAMPLING -I TOOLS -I JASTROW -I MAIN -I PROPERTIES -I ZMQ"
|
||||||
|
Loading…
Reference in New Issue
Block a user