diff --git a/Makefile b/Makefile index 4444cc8..77d1681 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ src/MAIN/qmc src/MAIN/qmc_create_walkers src/MAIN/qmcchem_info: lib/libezfio.a l # OCaml # ----- -ocaml/qmcchem: EZFIO/Ocaml/ezfio.ml ocaml/Property.ml +ocaml/qmcchem: EZFIO/Ocaml/ezfio.ml $(wildcard ocaml/*.ml) ./scripts/compile_ocaml.sh # Archive @@ -58,7 +58,7 @@ bin/qmcchem_info: src/MAIN/qmcchem_info bin/qmc_create_walkers: src/MAIN/qmc_create_walkers cp src/MAIN/qmc_create_walkers bin/ -bin/qmcchem: +bin/qmcchem: ocaml/qmcchem cp ocaml/qmcchem bin/ all: bin/qmc bin/qmcchem_info bin/qmc_create_walkers bin/qmcchem diff --git a/make.config.gfortran b/make.config.gfortran index c1bca00..ac6352b 100644 --- a/make.config.gfortran +++ b/make.config.gfortran @@ -7,7 +7,7 @@ CPU_TYPE="-mavx" ## FORTRAN compiler FC="gfortran -ffree-line-length-none" FCFLAGS="-O2 -g ${CPU_TYPE}" -LIB="-lblas -llapack" +LIB="-lblas -llapack -lpthread" ## IRPF90 IRPF90="${QMCCHEM_PATH}/bin/irpf90" diff --git a/make.config.ifort b/make.config.ifort index ce5434f..d241749 100644 --- a/make.config.ifort +++ b/make.config.ifort @@ -15,7 +15,7 @@ LIB="-mkl=sequential" ## IRPF90 IRPF90="${QMCCHEM_PATH}/bin/irpf90" -IRPF90_FLAGS="--align=${ALIGN} ${IRPF90_FLAGS}" +IRPF90_FLAGS="--align=${ALIGN}" export FC FCFLAGS LIB IRPF90 IRPF90_FLAGS diff --git a/ocaml/Qmcchem_dataserver.ml b/ocaml/Qmcchem_dataserver.ml index 6242529..70c605d 100644 --- a/ocaml/Qmcchem_dataserver.ml +++ b/ocaml/Qmcchem_dataserver.ml @@ -48,10 +48,10 @@ let run ?(daemon=true) ezfio_filename = in - (** Measures the time difference between [t0] and [Unix.time ()] *) + (** Measures the time difference between [t0] and [Unix.gettimeofday ()] *) let delta_t t0 = let t1 = - Unix.time () + Unix.gettimeofday () in t1 -. t0 in @@ -149,7 +149,7 @@ let run ?(daemon=true) ezfio_filename = delta_t t0 in let message = - Printf.sprintf "%20s : %8d : %10s : %f" + Printf.sprintf "%20s : %8d : %10s : %e" socket size text dt in Zmq.Socket.send debug_socket message @@ -183,7 +183,7 @@ let run ?(daemon=true) ezfio_filename = (** Array of walkers. The size is [walk_num_tot]. *) let walkers_array = let t0 = - Unix.time () + Unix.gettimeofday () in let j = 3*elec_num + 3 @@ -218,7 +218,7 @@ let run ?(daemon=true) ezfio_filename = (** Last time when the walkers were saved to disk. *) let last_save_walkers = - ref (Unix.time ()) + ref (Unix.gettimeofday ()) in @@ -227,7 +227,7 @@ let run ?(daemon=true) ezfio_filename = if (delta_t !last_save_walkers > 10. ) then begin let t0 = - Unix.time () + Unix.gettimeofday () in Ezfio.set_electrons_elec_coord_pool_size walk_num_tot ; let walkers_list = @@ -239,7 +239,7 @@ let run ?(daemon=true) ezfio_filename = Ezfio.set_electrons_elec_coord_pool (Ezfio.ezfio_array_of_list ~rank:3 ~dim:[| elec_num+1 ; 3 ; walk_num_tot |] ~data:walkers_list); send_log "status" walk_num_tot t0 "Saved walkers"; - last_save_walkers := Unix.time (); + last_save_walkers := Unix.gettimeofday (); end in @@ -292,7 +292,7 @@ let run ?(daemon=true) ezfio_filename = in match Hashtbl.find_opt workers_hash s with | Some _ -> failwith (s^" already registered") - | None -> Hashtbl.add workers_hash s (Unix.time ()) + | None -> Hashtbl.add workers_hash s (Unix.gettimeofday ()) in @@ -310,12 +310,12 @@ let run ?(daemon=true) ezfio_filename = - (** Sets the last access of the worker to [Unix.time ()] *) + (** Sets the last access of the worker to [Unix.gettimeofday ()] *) let touch_worker w pid = let s = key w pid in - Hashtbl.replace workers_hash s (Unix.time ()) + Hashtbl.replace workers_hash s (Unix.gettimeofday ()) in @@ -386,7 +386,7 @@ let run ?(daemon=true) ezfio_filename = *) let compress_block_file filename = let t0 = - Unix.time () + Unix.gettimeofday () in close_out !block_channel; Unix.rename block_channel_filename_locked block_channel_filename_tmp; @@ -406,7 +406,7 @@ let run ?(daemon=true) ezfio_filename = let start_status_thread = let t0 = - Unix.time () + Unix.gettimeofday () in Thread.create (fun () -> send_log "status" 0 t0 "Starting status thread"; @@ -422,7 +422,7 @@ let run ?(daemon=true) ezfio_filename = in let start_time = - Unix.time () + Unix.gettimeofday () and stop_time = ref (Input.Stop_time.(read () |> to_float) ) in @@ -435,7 +435,7 @@ let run ?(daemon=true) ezfio_filename = do Unix.sleepf delay; let now = - Unix.time () + Unix.gettimeofday () in let status_string = Status.to_string !status @@ -490,7 +490,7 @@ let run ?(daemon=true) ezfio_filename = let start_log_thread = let t0 = - Unix.time () + Unix.gettimeofday () in Thread.create (fun () -> send_log "status" 0 t0 "Starting log thread"; @@ -520,7 +520,7 @@ let run ?(daemon=true) ezfio_filename = |> String.concat " " in let now = - Unix.time () + Unix.gettimeofday () in send_log "log" 0 now message end @@ -556,7 +556,7 @@ let run ?(daemon=true) ezfio_filename = let start_main_thread = let wall0 = - Unix.time () + Unix.gettimeofday () in let f () = @@ -627,7 +627,7 @@ let run ?(daemon=true) ezfio_filename = Zmq.Socket.recv_all ~block:false rep_socket in let t0 = - Unix.time () + Unix.gettimeofday () in let msg = List.map String.trim raw_msg @@ -712,7 +712,7 @@ let run ?(daemon=true) ezfio_filename = Zmq.Socket.recv_all ~block:false pull_socket in let t0 = - Unix.time () + Unix.gettimeofday () in let msg = List.map String.trim raw_msg @@ -746,7 +746,7 @@ let run ?(daemon=true) ezfio_filename = done; let wall = Printf.sprintf "%f %f # %s %s %s %d" - (Unix.time () -. wall0) + (Unix.gettimeofday () -. wall0) 1. (Property.to_string Property.Wall) hostname (string_of_int dataserver_pid) 1 |> Block.of_string @@ -838,7 +838,7 @@ let run ?(daemon=true) ezfio_filename = (** {3 Main function} *) let t0 = - Unix.time () + Unix.gettimeofday () in (* Handle signals *) diff --git a/ocaml/Qmcchem_forwarder.ml b/ocaml/Qmcchem_forwarder.ml index f5bda97..929356b 100644 --- a/ocaml/Qmcchem_forwarder.ml +++ b/ocaml/Qmcchem_forwarder.ml @@ -466,6 +466,7 @@ let run ezfio_filename dataserver = int_of_string n_str in let len = + if !walk_num = 0 then n else n / !walk_num in if (n < 5*len) then diff --git a/ocaml/Time.ml b/ocaml/Time.ml index 8bc5afb..91c620f 100644 --- a/ocaml/Time.ml +++ b/ocaml/Time.ml @@ -39,7 +39,7 @@ let string_of_date t = let string_of_now () = - Unix.time () + Unix.gettimeofday () |> Unix.localtime |> string_of_date