Added Node module in parallel

This commit is contained in:
Anthony Scemama 2019-03-29 23:15:57 +01:00
parent 1896d9c45f
commit 0897beabd5
1 changed files with 20 additions and 0 deletions

View File

@ -55,6 +55,26 @@ let broadcast_vec x =
Lacaml.D.Vec.of_array a
module Node = struct
let name = Unix.gethostname ()
let comm_node =
Mpi.allgather (name, rank) Mpi.comm_world
|> Array.to_list
|> List.filter (fun (n, r) -> name = n)
|> List.map snd
|> Array.of_list
|> Mpi.(group_incl (comm_group comm_world))
|> Mpi.(comm_create comm_world)
let rank =
Mpi.comm_rank comm_node
let master = rank = 0
end
module Vec = struct