Module Vector


module Vector: sig .. end
Manages Spoc vectors

type device_vec 
type customarray 

type 'a custom = {
   elt : 'a; (*an element of the vector*)
   size : int; (*the size of an element when transfered 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 custom

shortcuts
val int32 : (int32, Bigarray.int32_elt) kind
val char : (char, Bigarray.int8_unsigned_elt) kind
val int64 : (int64, Bigarray.int64_elt) kind
val float32 : (float, Bigarray.float32_elt) kind
val float64 : (float, Bigarray.float64_elt) kind
val complex32 : (Complex.t, Bigarray.complex32_elt) kind

type ('a, 'b) spoc_vec =
| Bigarray of ('a, 'b, Bigarray.c_layout) Bigarray.Array1.t
| CustomArray of (customarray * 'a custom)
a spoc_vector is a Bigarray or a custom vector

type vec_device =
| No_dev
| Dev of Devices.device
| Transferring of Devices.device

type ('a, 'b) sub =
| None
| Some of int * int * int * int * ('a, 'b) vector
a vector represents every information needed by Spoc to manage it
type ('a, 'b) vector 
val create : ('a, 'b) kind -> int -> ('a, 'b) vector
Returns a new vector.

the length of a given vector

val length : ('a, 'b) vector -> int
val dev : ('a, 'b) vector -> vec_device
val is_sub : ('a, 'b) vector -> ('a, 'b) sub
val kind : ('a, 'b) vector -> ('a, 'b) kind
val device : ('a, 'b) vector -> int
val get_vec_id : ('a, 'b) vector -> int
val vector : ('a, 'b) vector -> ('a, 'b) spoc_vec
val equals : ('a, 'b) vector -> ('a, 'b) vector -> bool
val unsafe_get : ('a, 'b) vector -> int -> 'a
val unsafe_set : ('a, 'b) vector -> int -> 'a -> unit
val update_device_array : ('a, 'b) vector -> ('a, 'b) vector -> unit
val set_device : ('a, 'b) vector -> int -> vec_device -> unit
val temp_vector : ('a, 'b) vector -> ('a, 'b) vector
val sub_vector : ('a, 'b) vector -> int -> int -> int -> int -> ('a, 'b) vector
val device_vec : ('a, 'b) vector -> [< `Cuda | `OpenCL ] -> int -> device_vec
val copy_sub : ('a, 'b) vector -> ('a, 'b) vector -> unit