Documentation ¶
Index ¶
- Constants
- func CreateStream() (Stream, EIcicleError)
- func GetActiveDevice() (*Device, EIcicleError)
- func GetAvailableMemory() (*AvailableMemory, EIcicleError)
- func GetDeviceProperties() (*DeviceProperties, EIcicleError)
- func IsActiveDeviceMemory(ptr unsafe.Pointer) bool
- func IsDeviceAvailable(device *Device) bool
- func IsHostMemory(ptr unsafe.Pointer) bool
- func RunOnDevice(device *Device, funcToRun func(args ...any), args ...any)
- type AvailableMemory
- type Device
- type DeviceProperties
- type EIcicleError
- func CopyFromDevice(hostDst, deviceSrc unsafe.Pointer, size uint) (unsafe.Pointer, EIcicleError)
- func CopyFromDeviceAsync(hostDst, deviceSrc unsafe.Pointer, size uint, stream Stream) EIcicleError
- func CopyToDevice(deviceDst, hostSrc unsafe.Pointer, size uint) (unsafe.Pointer, EIcicleError)
- func CopyToDeviceAsync(deviceDst, hostSrc unsafe.Pointer, size uint, stream Stream) EIcicleError
- func DestroyStream(stream Stream) EIcicleError
- func DeviceSynchronize() EIcicleError
- func Free(devicePtr unsafe.Pointer) EIcicleError
- func FreeAsync(devicePtr unsafe.Pointer, stream Stream) EIcicleError
- func GetDeviceCount() (int, EIcicleError)
- func GetRegisteredDevices() ([]string, EIcicleError)
- func LoadBackend(path string, isRecursive bool) EIcicleError
- func LoadBackendFromEnvOrDefault() EIcicleError
- func Malloc(size uint) (unsafe.Pointer, EIcicleError)
- func MallocAsync(size uint, stream Stream) (unsafe.Pointer, EIcicleError)
- func MemSet(devicePtr unsafe.Pointer, value int, size uint) EIcicleError
- func MemSetAsync(devicePtr unsafe.Pointer, value int, size uint, stream Stream) EIcicleError
- func SetDevice(device *Device) EIcicleError
- func SynchronizeStream(stream Stream) EIcicleError
- type Stream
Constants ¶
View Source
const MAX_TYPE_SIZE = 64
Variables ¶
This section is empty.
Functions ¶
func CreateStream ¶
func CreateStream() (Stream, EIcicleError)
func GetActiveDevice ¶
func GetActiveDevice() (*Device, EIcicleError)
func GetAvailableMemory ¶
func GetAvailableMemory() (*AvailableMemory, EIcicleError)
func GetDeviceProperties ¶
func GetDeviceProperties() (*DeviceProperties, EIcicleError)
func IsActiveDeviceMemory ¶
func IsDeviceAvailable ¶
func IsHostMemory ¶
func RunOnDevice ¶
// This will always print "Inner goroutine device: 0" // go func () { // device, _ := runtime.GetActiveDevice() // fmt.Println("Inner goroutine device: ", device.Id) // }()
// To force the above goroutine to same device as the wrapping function: // RunOnDevice(i, func(arg ...any) { // device, _ := runtime.GetActiveDevice() // fmt.Println("Inner goroutine device: ", device.Id) // }) . . .
}, i)
Types ¶
type AvailableMemory ¶
type Device ¶
type Device struct { DeviceType [MAX_TYPE_SIZE]C.char Id int32 }
func CreateDevice ¶
func (*Device) GetDeviceType ¶
type DeviceProperties ¶
type EIcicleError ¶
type EIcicleError int
eIcicleError represents the error codes
const ( Success EIcicleError = iota // Operation completed successfully InvalidDevice // The specified device is invalid OutOfMemory // Memory allocation failed due to insufficient memory InvalidPointer // The specified pointer is invalid AllocationFailed // Memory allocation failed DeallocationFailed // Memory deallocation failed CopyFailed // Data copy operation failed SynchronizationFailed // Device synchronization failed StreamCreationFailed // Stream creation failed StreamDestructionFailed // Stream destruction failed ApiNotImplemented // The API is not implemented for a device InvalidArgument // Invalid argument passed BackendLoadFailed // Failed to load the backend LicenseCheckError // Failed to check license or invalid license UnknownError // An unknown error occurred )
func CopyFromDevice ¶
func CopyFromDeviceAsync ¶
func CopyFromDeviceAsync(hostDst, deviceSrc unsafe.Pointer, size uint, stream Stream) EIcicleError
func CopyToDevice ¶
func CopyToDeviceAsync ¶
func CopyToDeviceAsync(deviceDst, hostSrc unsafe.Pointer, size uint, stream Stream) EIcicleError
func DestroyStream ¶
func DestroyStream(stream Stream) EIcicleError
func DeviceSynchronize ¶
func DeviceSynchronize() EIcicleError
func Free ¶
func Free(devicePtr unsafe.Pointer) EIcicleError
func GetDeviceCount ¶
func GetDeviceCount() (int, EIcicleError)
func GetRegisteredDevices ¶
func GetRegisteredDevices() ([]string, EIcicleError)
func LoadBackend ¶
func LoadBackend(path string, isRecursive bool) EIcicleError
func LoadBackendFromEnvOrDefault ¶
func LoadBackendFromEnvOrDefault() EIcicleError
func MallocAsync ¶
func MallocAsync(size uint, stream Stream) (unsafe.Pointer, EIcicleError)
func MemSetAsync ¶
func SetDevice ¶
func SetDevice(device *Device) EIcicleError
func SynchronizeStream ¶
func SynchronizeStream(stream Stream) EIcicleError
Click to show internal directories.
Click to hide internal directories.