10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-06-02 03:15:19 +02:00

Removed MPI busy waiting

This commit is contained in:
Anthony Scemama 2019-03-20 23:19:52 +01:00
parent 0bae2bc9d1
commit e226bd135e

View File

@ -48,7 +48,13 @@ let run_parallel_server ~ordered stream =
let fetch_result () : (task_id * 'a) option * int = let fetch_result () : (task_id * 'a) option * int =
let (message, rank, _tag) : (task_id * 'a) option * int * int = let (message, rank, _tag) : (task_id * 'a) option * int * int =
debug "Before receive_status"; debug "Before receive_status";
Mpi.receive_status Mpi.any_source Mpi.any_tag Mpi.comm_world (* Avoid busy receive *)
let rec wait_and_receive () =
match Mpi.iprobe Mpi.any_source Mpi.any_tag Mpi.comm_world with
| Some _ -> Mpi.receive_status Mpi.any_source Mpi.any_tag Mpi.comm_world
| None -> (Unix.sleepf 0.001 ; wait_and_receive ())
in
wait_and_receive ()
in in
debug @@ Printf.sprintf "After receive_status %d %d" rank _tag; debug @@ Printf.sprintf "After receive_status %d %d" rank _tag;
message, rank message, rank