mirror of
https://gitlab.com/scemama/QCaml.git
synced 2024-08-30 00:03:42 +02:00
23 lines
736 B
OCaml
23 lines
736 B
OCaml
|
|
let () =
|
|
Printf.printf "Hello from rank %d of %d.\n" Parallel.rank Parallel.size;
|
|
let () = Parallel.barrier () in
|
|
(*
|
|
let v = Parallel.Vec.init 47 (fun i -> float_of_int i) in
|
|
*)
|
|
let a = Array.init 41 (fun i -> float_of_int (i+1)) |> Lacaml.D.Vec.of_array in
|
|
let b = Array.init 41 (fun i -> float_of_int (3*i+1)) |> Lacaml.D.Vec.of_array in
|
|
let v1 = Parallel.Vec.of_vec a in
|
|
let v2 = Parallel.Vec.of_vec b in
|
|
let d1 = Parallel.dot v1 v2 |> Parallel.broadcast_float in
|
|
let d2 = Lacaml.D.dot a b in
|
|
(*
|
|
let w = Parallel.Vec.to_vec v in
|
|
Format.printf "%a" Parallel.Vec.pp v;
|
|
if Parallel.master then
|
|
Format.printf "@[%a@]@;" (Lacaml.Io.pp_lfvec ()) w;
|
|
*)
|
|
Printf.printf "%f %f\n" d1 d2;
|
|
print_newline ();
|
|
|