For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).
Mojo struct
SHMEMBuffer
struct SHMEMBuffer[dtype: DType]
Implemented traitsβ
AnyType,
DevicePassable,
ImplicitlyDestructible,
Sized
comptime membersβ
device_typeβ
comptime device_type = UnsafePointer[Scalar[dtype], MutAnyOrigin]
Methodsβ
__del__β
__del__(deinit self)
get_type_nameβ
__len__β
unsafe_ptrβ
unsafe_ptr(self) -> UnsafePointer[Scalar[dtype], MutAnyOrigin]
Returns:
enqueue_copy_toβ
enqueue_copy_to(self, dst_ptr: UnsafePointer[Scalar[dtype], MutAnyOrigin])
Enqueues an asynchronous copy from this buffer to host memory.
This method schedules a memory copy operation from this device buffer to the specified host memory location. The operation is asynchronous and will be executed in the stream associated with this buffer's context.
Args:
- βdst_ptr (
UnsafePointer[Scalar[dtype], MutAnyOrigin]): Pointer to the destination host memory location.
enqueue_copy_to(self, dst: HostBuffer[dtype])
Enqueues an asynchronous copy from this buffer to host memory.
This method schedules a memory copy operation from this device buffer to the specified host memory location. The operation is asynchronous and will be executed in the stream associated with this buffer's context.
Args:
- βdst (
HostBuffer[dtype]): Host buffer to copy to.
Raises:
If the copy operation fails.
enqueue_copy_fromβ
enqueue_copy_from(self, src_ptr: UnsafePointer[Scalar[dtype], MutAnyOrigin])
Enqueues an asynchronous copy from host memory to this buffer.
This method schedules a memory copy operation from the specified host memory location to this device buffer. The operation is asynchronous and will be executed in the stream associated with this buffer's context.
Args:
- βsrc_ptr (
UnsafePointer[Scalar[dtype], MutAnyOrigin]): Pointer to the source host memory location.
Raises:
If the copy operation fails.
enqueue_copy_from(self, src: HostBuffer[dtype])
Enqueues an asynchronous copy from host memory to this buffer.
This method schedules a memory copy operation from the specified host memory location to this device buffer. The operation is asynchronous and will be executed in the stream associated with this buffer's context.
Args:
- βsrc (
HostBuffer[dtype]): Host buffer to copy from.
Raises:
If the copy operation fails.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!