10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-10-31 19:23:40 +01:00
QCaml/Parallel/Parallel.mli

108 lines
3.3 KiB
OCaml
Raw Normal View History

2018-10-16 00:27:58 +02:00
(** Module for handling distributed parallelism *)
val size : int
(** Number of distributed processes. *)
val rank : Mpi.rank
2018-10-16 19:09:00 +02:00
(** Rank of the current distributed processe. *)
2018-10-17 10:38:07 +02:00
val master : bool
(** True if [rank = 0]. *)
2018-10-16 19:09:00 +02:00
val barrier : unit -> unit
(** Wait for all processes to reach this point. *)
(** {5 Vector operations} *)
module Vec : sig
2018-10-17 11:44:28 +02:00
type t = private
2018-10-16 19:09:00 +02:00
{
global_first : int ; (* Lower index in the global array *)
global_last : int ; (* Higher index in the global array *)
local_first : int ; (* Lower index in the local array *)
local_last : int ; (* Higher index in the local array *)
data : Lacaml.D.vec ; (* Lacaml vector containing the data *)
}
val pp : Format.formatter -> t -> unit
2018-10-17 11:44:28 +02:00
(** {6 Creation/conversion of vectors} *)
2018-10-16 19:09:00 +02:00
val create : int -> t
(** [create n] @return a distributed vector with [n] rows (not initialized). *)
val make : int -> float -> t
(** [make n x] @return a distributed vector with [n] rows initialized with value [x]. *)
val make0 : int -> t
(** [make0 n x] @return a distributed vector with [n] rows initialized with the zero
element. *)
val init : int -> (int -> float) -> t
(** [init n f] @return a distributed vector containing [n] elements, where
each element at position [i] is initialized by the result of calling [f i]. *)
val of_array : float array -> t
(** [of_array ar] @return a distributed vector initialized from array [ar]. *)
val to_array : t -> float array
(** [to_array v] @return an array initialized from vector [v]. *)
val of_vec : Lacaml.D.vec -> t
(** [of_vec vec] @return a distributed vector initialized from Lacaml vector [vec]. *)
val to_vec : t -> Lacaml.D.vec
(** [to_vec v] @return a Lacaml vector initialized from vector [v]. *)
2018-10-17 11:44:28 +02:00
(** {6 Accessors } *)
val dim : t -> int
(** [dim v] @return the dimension of the vector [v]. *)
val global_first : t -> int
(** [global_first v] @return the index of the first element of [v]. *)
val global_last : t -> int
(** [global_last v] @return the index of the last element of [v]. *)
val local_first : t -> int
(** [local_first v] @return the index of the first element of the local piece of [v]. *)
val global_last : t -> int
(** [local_last v] @return the index of the last element of the local piece of [v]. *)
val data : t -> Lacaml.D.vec
(** [data v] @return the local Lacaml vector in which the piece of the vector [v] is stored. *)
2018-10-16 19:09:00 +02:00
end
(*
module Mat : sig
type t =
{
global_first_row : int ; (* Lower row index in the global array *)
global_last_row : int ; (* Higher row index in the global array *)
global_first_col : int ; (* Lower column index in the global array *)
global_last_col : int ; (* Higher column index in the global array *)
local_first_row : int ; (* Lower row index in the local array *)
local_last_row : int ; (* Higher row index in the local array *)
local_first_col : int ; (* Lower column index in the local array *)
local_last_col : int ; (* Higher column index in the local array *)
data : Lacaml.D.mat ; (* Lacaml matrix containing the data *)
}
end
val gemm : Mat.t -> Mat.t -> Mat.t
(* Distributed matrix-matrix product. The result is a distributed matrix. *)
2018-10-17 11:44:28 +02:00
*)
2018-10-16 19:09:00 +02:00
val dot : Vec.t -> Vec.t-> float
(* Dot product between distributed vectors. *)
2018-10-16 00:27:58 +02:00