Module Cuda_api.Memory

type 'a buffer = {
  1. ptr : Cuda_types.cu_deviceptr;
  2. size : int;
  3. elem_size : int;
  4. device : Device.t;
}
val alloc : Device.t -> int -> ('a, 'b) Stdlib.Bigarray.kind -> 'c buffer
val alloc_custom : Device.t -> size:int -> elem_size:int -> 'a buffer

Allocate buffer for custom types with explicit element size in bytes

val free : 'a buffer -> unit
val host_to_device : src:('a, 'b, 'c) Stdlib.Bigarray.Array1.t -> dst:'d buffer -> unit
val device_to_host : src:'a buffer -> dst:('b, 'c, 'd) Stdlib.Bigarray.Array1.t -> unit
val host_ptr_to_device : src_ptr:unit Ctypes_static.ptr -> byte_size:int -> dst:'a buffer -> unit

Transfer from raw pointer to device buffer (for custom types)

val device_to_host_ptr : src:'a buffer -> dst_ptr:unit Ctypes_static.ptr -> byte_size:int -> unit

Transfer from device buffer to raw pointer (for custom types)

val device_to_device : src:'a buffer -> dst:'b buffer -> unit
val memset : 'a buffer -> int -> unit