package spoc
Module Spoc.VectorSource
Manages Spoc vectors
type ('a, 'b) custom = {size : int;(*the size of an element when transferred to a gpgpu device
*)get : customarray -> int -> 'a;(*a function to access elements from the vector
*)set : customarray -> int -> 'a -> unit;(*a function to modify an element of the vector
*)
}Spoc offers many predefined vectors types. Custom vectors can contain any kind of data types.
Some predifined types
type ('a, 'b) kind = | Float32 of ('a, 'b) Bigarray.kind| Char of ('a, 'b) Bigarray.kind| Float64 of ('a, 'b) Bigarray.kind| Int32 of ('a, 'b) Bigarray.kind| Int64 of ('a, 'b) Bigarray.kind| Complex32 of ('a, 'b) Bigarray.kind| Custom of ('a, 'b) custom| Unit of ('a, 'b) couple| Dummy of ('a, 'b) couple
shortcuts
type ('a, 'b) spoc_vec = | Bigarray of ('a, 'b, Bigarray.c_layout) Bigarray.Array1.t| CustomArray of customarray * ('a, 'b) custom| Host_vec of ('a, 'b) host_vec
a spoc_vector is a Bigarray or a custom vector
a vector represents every information needed by Spoc to manage it It uses Bigarrays to manage data on the cpu side (see the OCaml Bigarray Module for more information)
sub vectors are vector parts sharing memory space on cpu memory BUT not on gpu memory, allowing easy computation distribution over multiple GPUs. sub-vector : sub_vector depth * start * ok range * ko range * parent vector (see samples for more info)
val of_bigarray_shr :
('a, 'b) kind ->
('a, 'b, Bigarray.c_layout) Bigarray.Array1.t ->
('a, 'b) vector