Cuda.DeviceptrThis module introduces the type of pointers into on-device global memory, and stream-independent memory management functions. All functions from this module run synchronously. See: Memory Management.
A pointer to a memory location on a device. See CUdeviceptr.
val sexp_of_t : t -> Sexplib0.Sexp.tval hash : t -> intConverts the pointer to an OCaml int using Unsigned.UInt64.to_int (truncating bits as needed).
val string_of : t -> stringHexadecimal representation of the pointer.
val mem_alloc : size_in_bytes:int -> tThe memory is aligned, is not cleared. See cuMemAlloc.
The pointer is finalized using cuMemFree. This is safe without needing to set the proper context.
val mem_free : t -> unitDouble-freeing is prevented by a flag: multiple calls on the same Deviceptr.t are safe. See cuMemFree.
val memcpy_H_to_D_unsafe :
dst:t ->
src:unit Ctypes.ptr ->
size_in_bytes:int ->
unitSee cuMemcpyHtoD.
val memcpy_H_to_D :
?host_offset:int ->
?length:int ->
dst:t ->
src:('a, 'b, 'c) Stdlib.Bigarray.Genarray.t ->
unit ->
unitCopies the bigarray (or its interval) into the device memory. host_offset and length are in numbers of elements. See memcpy_H_to_D_unsafe.
val alloc_and_memcpy : ('a, 'b, 'c) Stdlib.Bigarray.Genarray.t -> tCombines mem_alloc and memcpy_H_to_D.
val memcpy_D_to_H_unsafe :
dst:unit Ctypes.ptr ->
src:t ->
size_in_bytes:int ->
unitSee cuMemcpyDtoH.
val memcpy_D_to_H :
?host_offset:int ->
?length:int ->
dst:('a, 'b, 'c) Stdlib.Bigarray.Genarray.t ->
src:t ->
unit ->
unitCopies from the device memory into the bigarray (or its interval). host_offset and length are in numbers of elements. See memcpy_D_to_H_unsafe.
val memcpy_D_to_D :
?kind:('a, 'b) Stdlib.Bigarray.kind ->
?length:int ->
?size_in_bytes:int ->
dst:t ->
src:t ->
unit ->
unitCopies between two memory positions on the same device. The size to copy can optionally be provided in numbers of elements via kind and length. Provide either both kind and length, or just size_in_bytes. See cuMemcpyDtoD.
val memcpy_peer :
?kind:('a, 'b) Stdlib.Bigarray.kind ->
?length:int ->
?size_in_bytes:int ->
dst:t ->
dst_ctx:Context.t ->
src:t ->
src_ctx:Context.t ->
unit ->
unitCopies between memory positions on two different devices. The size to copy can optionally be provided in numbers of elements via kind and length. Provide either both kind and length, or just size_in_bytes. See cuMemcpyPeer.
val memset_d8 : t -> Unsigned.uchar -> length:int -> unitSee cuMemsetD8.
val memset_d16 : t -> Unsigned.ushort -> length:int -> unitlength is in number of elements. See cuMemsetD16.
val memset_d32 : t -> Unsigned.uint32 -> length:int -> unitlength is in number of elements. See cuMemsetD32.