10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-11-10 16:13:39 +01:00

Warn when nested parallel regions are found

This commit is contained in:
Anthony Scemama 2019-03-02 19:46:03 +01:00
parent 58e1be95e5
commit cadfbb1eef
2 changed files with 25 additions and 8 deletions

View File

@ -198,7 +198,8 @@ let make ?(n_states=1) det_space =
let mo_basis = Ds.mo_basis det_space in let mo_basis = Ds.mo_basis det_space in
(* While in a sequential region, initiate the parallel (* While in a sequential region, initiate the parallel
4-idx transformation *) 4-idx transformation
*)
ignore @@ MOBasis.two_e_ints mo_basis; ignore @@ MOBasis.two_e_ints mo_basis;
let f = let f =

View File

@ -210,15 +210,31 @@ let run_parallel_client f =
let run_parallel ~ordered f stream =
match Mpi.comm_rank Mpi.comm_world with
| 0 -> run_parallel_server ~ordered stream
| _ -> run_parallel_client f
let run_parallel ~ordered f stream =
match Mpi.comm_rank Mpi.comm_world with
| 0 -> run_parallel_server ~ordered stream
| _ -> run_parallel_client f
let nested = ref false
let run ?(ordered=true) ~f stream = let run ?(ordered=true) ~f stream =
match Mpi.comm_size Mpi.comm_world with if !nested then
| 1 -> run_sequential f stream begin
| _ -> run_parallel ~ordered f stream let message =
"Nested parallel regions are not supported by Farm.ml"
in
Printf.eprintf "%s\n%!" message ;
exit 1
end;
nested := true;
let result =
match Mpi.comm_size Mpi.comm_world with
| 1 -> run_sequential f stream
| _ -> run_parallel ~ordered f stream
in
nested := false;
result