Documentation
¶
Overview ¶
Package platform defines the interface for a GX
A GX platform manages a host and its associated devices, also providing the means to exchange data among them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HostTransfer ¶
func HostTransfer(dstB, srcB HostBuffer) error
HostTransfer transfers data from a source host buffer to another.
Types ¶
type Allocator ¶
type Allocator interface {
Allocate(*shape.Shape) (HostBuffer, error)
}
Allocator allocates memory on the host.
type Device ¶
type Device interface { // Platform returns the host and its devices owning this device. Platform() Platform // Send raw data to the device. Send(buf []byte, sh *shape.Shape) (DeviceHandle, error) // Ordinal of the device on the platform. Ordinal() int }
Device running GX code.
type DeviceHandle ¶
DeviceHandle is an array located on a device.
type Handle ¶
type Handle interface { // Shape of the underlying array. Shape() *shape.Shape // ToDevice transfers the handle to a device. ToDevice(Device) (DeviceHandle, error) // ToHost fetches the data from the handle and write it to buffer. ToHost(buffer HostBuffer) error }
Handle to an array managed by the platform.
type HostBuffer ¶
type HostBuffer interface { Handle // Acquire locks the buffer and returns it. // The buffer can be read or written by the caller. All other access is locked. // Returns nil if the handle has been freed. Acquire() []byte // Release the buffer. The caller of that function should not read or write data // from the buffer. Release() // Free the memory occupied by the buffer. The handle is invalid after calling this function. Free() }
HostBuffer is a handle to a buffer of data located locally on the platform, typically in CPU memory, and shared between a platform and its users.
The data needs to be acquired before being written or read. All access to the data is blocked until that is released.
Click to show internal directories.
Click to hide internal directories.