mirror of
https://gitlab.com/scemama/QCaml.git
synced 2024-11-19 12:32:21 +01:00
86 lines
2.7 KiB
OCaml
86 lines
2.7 KiB
OCaml
(** Module for handling distributed parallelism *)
|
|
|
|
val size : int
|
|
(** Number of distributed processes. *)
|
|
|
|
val rank : Mpi.rank
|
|
(** Rank of the current distributed processe. *)
|
|
|
|
val barrier : unit -> unit
|
|
(** Wait for all processes to reach this point. *)
|
|
|
|
(** {5 Vector operations} *)
|
|
module Vec : sig
|
|
|
|
type t =
|
|
{
|
|
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
|
|
|
|
(** {6 Creation/conversion of vectors and dimension accessor} *)
|
|
|
|
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]. *)
|
|
*)
|
|
|
|
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. *)
|
|
|
|
val dot : Vec.t -> Vec.t-> float
|
|
(* Dot product between distributed vectors. *)
|
|
*)
|
|
|
|
|
|
|