Documentation ¶
Overview ¶
event
program
Index ¶
- Constants
- Variables
- type Bytes
- type Device
- func (d *Device) AddProgram(source string) *Program
- func (d *Device) DriverVersion() string
- func (d *Device) Extensions() string
- func (d *Device) Kernel(name string) *Kernel
- func (d *Device) Name() string
- func (d *Device) NewBytes(size int) (*Bytes, error)
- func (d *Device) NewImage(imageType ImageType, bounds image.Rectangle) (*Image, error)
- func (d *Device) NewImageFromImage(img image.Image) (*Image, error)
- func (d *Device) NewVector(length int) (*Vector, error)
- func (d *Device) OpenCLCVersion() string
- func (d *Device) Profile() string
- func (d *Device) Release() error
- func (d *Device) String() string
- func (d *Device) Vendor() string
- func (d *Device) Version() string
- type DeviceType
- type ErrBlackCL
- type ErrUnsupportedArgumentType
- type Event
- type Image
- type ImageType
- type Kernel
- type KernelCall
- func (kc KernelCall) Global(globalWorkSizes ...int) KernelCall
- func (kc KernelCall) GlobalOffset(globalWorkOffsets ...int) KernelCall
- func (kc KernelCall) Local(localWorkSizes ...int) KernelCall
- func (kc KernelCall) Run(returnEvent bool, waitEvents []*Event, args ...interface{}) (event *Event, err error)
- type Program
- type Vector
Constants ¶
const ( ImageTypeGray = ImageType(C.CL_INTENSITY) ImageTypeRGBA = ImageType(C.CL_RGBA) )
available image types
Variables ¶
var ( ErrDeviceNotFound = "cl: Device Not Found" ErrDeviceNotAvailable = "cl: Device Not Available" ErrCompilerNotAvailable = "cl: Compiler Not Available" ErrMemObjectAllocationFailure = "cl: Mem Object Allocation Failure" ErrOutOfResources = "cl: Out Of Resources" ErrOutOfHostMemory = "cl: Out Of Host Memory" ErrProfilingInfoNotAvailable = "cl: Profiling Info Not Available" ErrMemCopyOverlap = "cl: Mem Copy Overlap" ErrImageFormatMismatch = "cl: Image Format Mismatch" ErrImageFormatNotSupported = "cl: Image Format Not Supported" ErrBuildProgramFailure = "cl: Build Program Failure" ErrMapFailure = "cl: Map Failure" ErrMisalignedSubBufferOffset = "cl: Misaligned Sub Buffer Offset" ErrExecStatusErrorForEventsInWaitList = "cl: Exec Status Error For Events In Wait List" ErrCompileProgramFailure = "cl: Compile Program Failure" ErrLinkerNotAvailable = "cl: Linker Not Available" ErrLinkProgramFailure = "cl: Link Program Failure" ErrDevicePartitionFailed = "cl: Device Partition Failed" ErrKernelArgInfoNotAvailable = "cl: Kernel Arg Info Not Available" ErrInvalidValue = "cl: Invalid Value" ErrInvalidDeviceType = "cl: Invalid Device Type" ErrInvalidPlatform = "cl: Invalid Platform" ErrInvalidDevice = "cl: Invalid Device" ErrInvalidContext = "cl: Invalid Context" ErrInvalidQueueProperties = "cl: Invalid Queue Properties" ErrInvalidCommandQueue = "cl: Invalid Command Queue" ErrInvalidHostPtr = "cl: Invalid Host Ptr" ErrInvalidMemObject = "cl: Invalid Mem Object" ErrInvalidImageFormatDescriptor = "cl: Invalid Image Format Descriptor" ErrInvalidImageSize = "cl: Invalid Image Size" ErrInvalidSampler = "cl: Invalid Sampler" ErrInvalidBinary = "cl: Invalid Binary" ErrInvalidBuildOptions = "cl: Invalid Build Options" ErrInvalidProgram = "cl: Invalid Program" ErrInvalidProgramExecutable = "cl: Invalid Program Executable" ErrInvalidKernelName = "cl: Invalid Kernel Name" ErrInvalidKernelDefinition = "cl: Invalid Kernel Definition" ErrInvalidKernel = "cl: Invalid Kernel" ErrInvalidArgIndex = "cl: Invalid Arg Index" ErrInvalidArgValue = "cl: Invalid Arg Value" ErrInvalidArgSize = "cl: Invalid Arg Size" ErrInvalidKernelArgs = "cl: Invalid Kernel Args" ErrInvalidWorkDimension = "cl: Invalid Work Dimension" ErrInvalidWorkGroupSize = "cl: Invalid Work Group Size" ErrInvalidWorkItemSize = "cl: Invalid Work Item Size" ErrInvalidGlobalOffset = "cl: Invalid Global Offset" ErrInvalidEventWaitList = "cl: Invalid Event Wait List" ErrInvalidEvent = "cl: Invalid Event" ErrInvalidOperation = "cl: Invalid Operation" ErrInvalidGlObject = "cl: Invalid Gl Object" ErrInvalidBufferSize = "cl: Invalid Buffer Size" ErrInvalidMipLevel = "cl: Invalid Mip Level" ErrInvalidGlobalWorkSize = "cl: Invalid Global Work Size" ErrInvalidProperty = "cl: Invalid Property" ErrInvalidImageDescriptor = "cl: Invalid Image Descriptor" ErrInvalidCompilerOptions = "cl: Invalid Compiler Options" ErrInvalidLinkerOptions = "cl: Invalid Linker Options" ErrInvalidDevicePartitionCount = "cl: Invalid Device Partition Count" )
Common OpenCl errors
var ( //ErrUnknown Generally an unexpected result from an OpenCL function (e.g. CL_SUCCESS but null pointer) ErrUnknown = errors.New("cl: unknown error") )
Functions ¶
This section is empty.
Types ¶
type Bytes ¶
type Bytes struct {
// contains filtered or unexported fields
}
Bytes is a memory buffer on the device that holds []byte
func (*Bytes) Copy ¶
Copy copies the data from host data to device buffer it's a non-blocking call, channel will return an error or nil if the data transfer is complete
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
Device the only needed entrence for the BlackCL represents the device on which memory can be allocated and kernels run it abstracts away all the complexity of contexts/platforms/queues
func GetDevices ¶
func GetDevices(deviceType DeviceType) ([]*Device, error)
GetDevices returns all devices of all platforms with specified type
func (*Device) AddProgram ¶
AddProgram copiles program source if an error ocurres in building the program the AddProgram will panic
func (*Device) DriverVersion ¶
DriverVersion device info - driver version
func (*Device) Extensions ¶
Extensions device info - extensions
func (*Device) Kernel ¶
Kernel returns an kernel if retrieving the kernel didn't complete the function will panic
func (*Device) NewImageFromImage ¶
NewImageFromImage creates new Image and copies data from image.Image
func (*Device) OpenCLCVersion ¶
OpenCLCVersion device info - OpenCL C Version
type DeviceType ¶
type DeviceType uint
DeviceType is an enum of device types
const ( DeviceTypeCPU DeviceType = C.CL_DEVICE_TYPE_CPU DeviceTypeGPU DeviceType = C.CL_DEVICE_TYPE_GPU DeviceTypeAccelerator DeviceType = C.CL_DEVICE_TYPE_ACCELERATOR DeviceTypeDefault DeviceType = C.CL_DEVICE_TYPE_DEFAULT DeviceTypeAll DeviceType = C.CL_DEVICE_TYPE_ALL )
All values of DeviceType
type ErrBlackCL ¶
ErrBlackCL converts the OpenCL error code to an go error
func (ErrBlackCL) Error ¶
func (e ErrBlackCL) Error() string
type ErrUnsupportedArgumentType ¶
type ErrUnsupportedArgumentType struct { Index int Value interface{} }
ErrUnsupportedArgumentType error
func (ErrUnsupportedArgumentType) Error ¶
func (e ErrUnsupportedArgumentType) Error() string
type Image ¶
type Image struct {
// contains filtered or unexported fields
}
Image memory buffer on the device with image data
type Kernel ¶
type Kernel struct {
// contains filtered or unexported fields
}
Kernel represent an single kernel
func (*Kernel) Global ¶
func (k *Kernel) Global(globalWorkSizes ...int) KernelCall
Global returns an KernelCall with global size set
func (*Kernel) GlobalOffset ¶
func (k *Kernel) GlobalOffset(globalWorkOffsets ...int) KernelCall
Global returns an kernel with global offsets set
func (*Kernel) Local ¶
func (k *Kernel) Local(localWorkSizes ...int) KernelCall
Local sets the local work sizes and returns an KernelCall which takes kernel arguments and runs the kernel
type KernelCall ¶
type KernelCall struct {
// contains filtered or unexported fields
}
KernelCall is a kernel with global and local work sizes set and it's ready to be run
func (KernelCall) Global ¶
func (kc KernelCall) Global(globalWorkSizes ...int) KernelCall
Global returns an KernelCall with global size set
func (KernelCall) GlobalOffset ¶
func (kc KernelCall) GlobalOffset(globalWorkOffsets ...int) KernelCall
Global returns an kernel with global offsets set
func (KernelCall) Local ¶
func (kc KernelCall) Local(localWorkSizes ...int) KernelCall
Local sets the local work sizes and returns an KernelCall which takes kernel arguments and runs the kernel
func (KernelCall) Run ¶
func (kc KernelCall) Run(returnEvent bool, waitEvents []*Event, args ...interface{}) (event *Event, err error)
Run calls the kernel on its device with specified global and local work sizes and arguments It's a non-blocking call, so it can return an event object that you can wait on. The caller is responsible to release the returned event when it's not used anymore.
type Program ¶
type Program struct {
// contains filtered or unexported fields
}
func (*Program) GetBinaries ¶
Return the program binaries associated with program.
type Vector ¶
type Vector struct {
// contains filtered or unexported fields
}
Vector is a memory buffer on device that holds []float32
func (*Vector) Copy ¶
Copy copies the float32 data from host data to device buffer it's a non-blocking call, channel will return an error or nil if the data transfer is complete