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);
|
||||
in
|
||||
bind_socket "PUB" pub_socket address;
|
||||
at_exit (fun () ->
|
||||
Sys.remove (Printf.sprintf "%s:%d" Qmcchem_config.dev_shm (port+1))
|
||||
);
|
||||
|
||||
let sub_socket =
|
||||
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);
|
||||
in
|
||||
bind_socket "XSUB" sub_socket address;
|
||||
at_exit (fun () ->
|
||||
Sys.remove (Printf.sprintf "%s:%d" Qmcchem_config.dev_shm (port+3))
|
||||
);
|
||||
|
||||
let pub_socket =
|
||||
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);
|
||||
in
|
||||
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_send_high_water_mark router_socket 100000;
|
||||
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);
|
||||
in
|
||||
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. *)
|
||||
|
@ -37,15 +37,18 @@ let to_int = function
|
||||
| Stopping -> 3
|
||||
;;
|
||||
|
||||
let is_set = ref false
|
||||
|
||||
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 ()
|
||||
|> of_int
|
||||
;;
|
||||
|
||||
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
|
||||
|> Ezfio.set_simulation_do_run
|
||||
;;
|
||||
|
@ -296,7 +296,7 @@ let input_lines filename =
|
||||
let create_ezfio_handler () =
|
||||
let lines =
|
||||
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.map (fun x ->
|
||||
match x with
|
||||
|
@ -12,7 +12,7 @@ cd ${QMCCHEM_PATH}/src || exit -1
|
||||
|
||||
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"
|
||||
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"
|
||||
|
Loading…
Reference in New Issue
Block a user