module Vector: sig
.. end
Manages Spoc vectors
Manages Spoc vectors
type
device_vec
type
customarray
type 'a
custom = {
}
Spoc offers many predefined vectors types.
Custom vectors can contain any kind of data types.
Some predifined types
type ('a, 'b)
couple = 'a * 'b
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 |
| |
Unit of ('a, 'b) couple |
| |
Dummy of ('a, 'b) couple |
shortcuts
val int : (int, Bigarray.int_elt) kind
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 Spoc.Devices.device |
| |
Transferring of Spoc.Devices.device |
type ('a, 'b)
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 informations)
type ('a, 'b)
sub = int * int * int * int * ('a, 'b) vector
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 create : ('a, 'b) kind ->
?dev:Spoc.Devices.device -> 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
Returns the device where the given vector is located
val is_sub : ('a, 'b) vector -> ('a, 'b) sub option
checks if a vector is a subvector
val kind : ('a, 'b) vector -> ('a, 'b) kind
Returns the kind of a vector
val device : ('a, 'b) vector -> int
Returns the device id where the given vector is located
val equals : ('a, 'b) vector -> ('a, 'b) vector -> bool
checks equality between two vectors
val vseek : ('a, 'b) vector -> int -> unit
val get_seek : ('a, 'b) vector -> int
val unsafe_get : ('a, 'b) vector -> int -> 'a
val unsafe_set : ('a, 'b) vector -> int -> 'a -> unit
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
val of_bigarray_shr : ('a, 'b) kind ->
('a, 'b, Bigarray.c_layout) Bigarray.Array1.t -> ('a, 'b) vector
val to_bigarray_shr : ('a, 'b) vector -> ('a, 'b, Bigarray.c_layout) Bigarray.Array1.t