diff --git a/Parallel_mpi/Parallel.ml b/Parallel_mpi/Parallel.ml index 5fff1dd..92353ba 100644 --- a/Parallel_mpi/Parallel.ml +++ b/Parallel_mpi/Parallel.ml @@ -123,25 +123,18 @@ module InterNode = struct Mpi.group_incl world_group ranks in - let result = - Some (Mpi.comm_create Mpi.comm_world new_group) - in - try - ignore @@ List.find (fun x -> x = world_rank) @@ Array.to_list ranks; - result - with Not_found -> None + Mpi.comm_create Mpi.comm_world new_group let rank = - match comm with - | Some c-> Mpi.comm_rank c - | None -> -1 + if comm <> Mpi.comm_none then + Mpi.comm_rank c + else 0 let master = rank = 0 let broadcast_generic broadcast x = - match comm with - | Some comm -> + if Mpi.comm_rank <> Mpi.comm_none then begin let x = if master then Some (Lazy.force x) @@ -150,15 +143,18 @@ module InterNode = struct match broadcast x 0 comm with | Some x -> x | None -> assert false - end - | None -> Lazy.force x + else + Lazy.force x let broadcast x = broadcast_generic Mpi.broadcast x +(* TODO : temporary single-node fix + let broadcast x = Lazy.force x +*) let barrier () = - match comm with - | Some comm -> Mpi.barrier comm - | None -> () + if comm <> Mpi.comm_none then + Mpi.barrier comm + else () let _ = barrier () diff --git a/Parallel_mpi/Parallel.mli b/Parallel_mpi/Parallel.mli index 381656e..129ee50 100644 --- a/Parallel_mpi/Parallel.mli +++ b/Parallel_mpi/Parallel.mli @@ -60,7 +60,7 @@ end (** {5 Inter-node operations} *) module InterNode : sig - val comm : Mpi.communicator option + val comm : Mpi.communicator (** MPI Communicator among the master processes of the each node *) val rank : Mpi.rank diff --git a/run_fci_f12.ml b/run_fci_f12.ml index c1521a3..0653f6a 100644 --- a/run_fci_f12.ml +++ b/run_fci_f12.ml @@ -96,7 +96,7 @@ let () = Simulation.of_filenames ~f12 ~charge ~multiplicity ~nuclei:nuclei_file basis_file in - let hf = HartreeFock.make ~guess:`Huckel simulation in + let hf = HartreeFock.make ~guess:`Hcore simulation in if Parallel.master then Format.fprintf ppf "@[%a@]@." HartreeFock.pp hf;