diff --git a/ocaml/Qmcchem_forwarder.ml b/ocaml/Qmcchem_forwarder.ml index 33e84a9..11b27ee 100644 --- a/ocaml/Qmcchem_forwarder.ml +++ b/ocaml/Qmcchem_forwarder.ml @@ -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. *) diff --git a/ocaml/Status.ml b/ocaml/Status.ml index af10168..f2338e2 100644 --- a/ocaml/Status.ml +++ b/ocaml/Status.ml @@ -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 ;; diff --git a/ocaml/qptypes_generator.ml b/ocaml/qptypes_generator.ml index 981686e..e57b9f4 100644 --- a/ocaml/qptypes_generator.ml +++ b/ocaml/qptypes_generator.ml @@ -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 diff --git a/scripts/compile_src.sh b/scripts/compile_src.sh index 9e22e19..f9f9cab 100755 --- a/scripts/compile_src.sh +++ b/scripts/compile_src.sh @@ -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"