Cudajit.Deviceptr
This 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.t
val string_of : t -> string
Hexadecimal representation of the pointer.
val mem_alloc : size_in_bytes:int -> t
The 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 memcpy_H_to_D_unsafe :
dst:t ->
src:unit Ctypes.ptr ->
size_in_bytes:int ->
unit
See cuMemcpyHtoD.
val memcpy_H_to_D :
?host_offset:int ->
?length:int ->
dst:t ->
src:('a, 'b, 'c) Stdlib.Bigarray.Genarray.t ->
unit ->
unit
Copies 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 -> t
Combines mem_alloc
and memcpy_H_to_D
.
val memcpy_D_to_H_unsafe :
dst:unit Ctypes.ptr ->
src:t ->
size_in_bytes:int ->
unit
See cuMemcpyDtoH.
val memcpy_D_to_H :
?host_offset:int ->
?length:int ->
dst:('a, 'b, 'c) Stdlib.Bigarray.Genarray.t ->
src:t ->
unit ->
unit
Copies 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 ->
unit
Copies 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 ->
unit
Copies 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 -> unit
See cuMemsetD8.
val memset_d16 : t -> Unsigned.ushort -> length:int -> unit
length
is in number of elements. See cuMemsetD16.
val memset_d32 : t -> Unsigned.uint32 -> length:int -> unit
length
is in number of elements. See cuMemsetD32.