Module Mem

module Mem: sig .. end
Manages memory transfers


Manages memory transfers
val auto_transfers : bool -> unit
By default Spoc wiil automatically handle memory transfers To make explicit transfers you have to stop auto_transfers

auto_transfers true will make transfers automatic

auto_transfers false will stop Spoc to make automatic transfers

default is : auto_transfers true

val unsafe_rw : bool -> unit
val to_device : ('a, 'b) Spoc.Vector.vector -> ?queue_id:int -> Spoc.Devices.device -> unit
Explicit transfer to a device

to_device v d will transfer the vector v to the device d

queue_id : allows to specify which command queue to use for the transfer

transfers are asynchronous, to_device will return immediately,

use Devices.flush to wait for the end of the command queue

val to_cpu : ('a, 'b) Spoc.Vector.vector -> ?queue_id:int -> unit -> unit
Explicit transfer from a device

to_cpu v will transfer the vector v from its current location to the cpu

queue_id : allows to specify which command queue to use for the transfer

transfers are asynchronous, to_cpu will return immediately,

use Devices.flush to wait for the end of the command queue

val set : ('a, 'b) Spoc.Vector.vector -> int -> 'a -> unit
val get : ('a, 'b) Spoc.Vector.vector -> int -> 'a
val sub_vector : ('a, 'b) Spoc.Vector.vector ->
int -> ?ok_rng:int -> ?ko_rng:int -> int -> ('a, 'b) Spoc.Vector.vector
Returns a subvector from a given vector Subvectors share the same cpu memory space with the vector they are from. They do not share the same memory space on gpgpu devices. sub_vector vec start len will return a new vector of length len sharing the same cpu memory space with a starting from index start.
val sub_vector : ('a, 'b) Spoc.Vector.vector ->
int -> ?ok_rng:int -> ?ko_rng:int -> int -> ('a, 'b) Spoc.Vector.vector
val vector_copy : ('a, 'b) Spoc.Vector.vector ->
int -> ('a, 'b) Spoc.Vector.vector -> int -> int -> unit
experimental :
Returns a copy of a given vector, the copy takes place on the vector location (CPU/GPU)