Documentation ¶
Index ¶
- Constants
- func ErrorName(errCode cl.ErrorCode) string
- func NewSharedContext(devices []*Device) (*cl.Context, error)
- type Buffer
- func (b *Buffer) Allocate(size int, flags cl.MemFlags) error
- func (b *Buffer) AllocateAndWriteData(data interface{}, flags cl.MemFlags) error
- func (b *Buffer) AllocateToFitData(data interface{}, flags cl.MemFlags) error
- func (b *Buffer) CopyDataFrom(src *Buffer, srcOffset, dstOffset, size int) error
- func (b *Buffer) Handle() cl.Mem
- func (b *Buffer) ReadData(srcOffset, dstOffset, size int, hostBuffer interface{}) error
- func (b *Buffer) ReadDataIntoSlice(sliceType interface{}) (interface{}, error)
- func (b *Buffer) Release()
- func (b *Buffer) Size() int
- func (b *Buffer) WriteData(data interface{}, offset int) error
- type Device
- type DeviceList
- type DeviceType
- type Kernel
- func (k *Kernel) Exec1D(offset, globalWorkSize, localWorkSize int) (time.Duration, error)
- func (k *Kernel) Exec1DNoWait(offset, globalWorkSize, localWorkSize int) (time.Duration, error)
- func (k *Kernel) Exec2D(offsetX, offsetY, globalWorkSizeX, globalWorkSizeY, localWorkSizeX, ... int) (time.Duration, error)
- func (k *Kernel) Release()
- func (k *Kernel) SetArgs(args ...interface{}) error
- type PlatformInfo
Constants ¶
const ( CpuDevice DeviceType = 1 << iota GpuDevice = 1 << iota OtherDevice = 1 << iota AllDevices = 0xFF )
Supported device types.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
func (*Buffer) AllocateAndWriteData ¶
Allocate a buffer with the given flags that is large enough to hold the given data and have opencl copy the data from the host pointer. The behavior of this method is undefined if a non-slice argument is passed or the argument does not use contiguous memory.
func (*Buffer) AllocateToFitData ¶
Allocate a buffer with enough capacity to fit the given data.
func (*Buffer) CopyDataFrom ¶
Copy data from the given buffer into this buffer.
func (*Buffer) ReadData ¶
Read data from device buffer into the supplied host buffer. The behavior of this method is undefined if a non-slice argument is passed or if the argument does not use contiguous memory.
If size is <= 0 then ReadData will read the entire bufer. Both src and dst offsets are specified in bytes.
func (*Buffer) ReadDataIntoSlice ¶
Read all data from device buffer into a slice of the given type. This method will allocate a new slice with enough capacity to fit the buffer data and will panic if the buffer size is not a multiple of the slice element size.
type Device ¶
type Device struct { Name string Id cl.DeviceId Type DeviceType // Speed estimate in GFlops. Speed uint32 // contains filtered or unexported fields }
Wrapper around opencl-supported devices.
func SelectDevices ¶
func SelectDevices(typeMask DeviceType, matchName string) ([]*Device, error)
Scan all available opencl platforms and select devices that match the given query.
func (*Device) WaitForKernels ¶
Wait for the any queued kernel executiont to compete.
type DeviceType ¶
type DeviceType uint8
func (DeviceType) String ¶
func (dt DeviceType) String() string
type Kernel ¶
type Kernel struct {
// contains filtered or unexported fields
}
A wrapper around opencl kernelHandles.
func (*Kernel) Exec1D ¶
Execute 1D kernel. If localWorSize is equal to 0 then the opencl implementation will pick the optimal worksize split for the underlying hardware.
func (*Kernel) Exec1DNoWait ¶
Execute 1D kernel. If localWorSize is equal to 0 then the opencl implementation will pick the optimal worksize split for the underlying hardware. This method will not wait for the kernel to finish. The client must manually invoke WaitForKernels() on the target device.
func (*Kernel) Exec2D ¶
func (k *Kernel) Exec2D(offsetX, offsetY, globalWorkSizeX, globalWorkSizeY, localWorkSizeX, localWorkSizeY int) (time.Duration, error)
Execute 2D kernel. If both localWorkSizeX and localWorkSizeY are 0 then the opencl implementation will pick the optimal local worksize split for the underlying hardware.
type PlatformInfo ¶
type PlatformInfo struct { Profile string Version string Name string Vendor string Extensions string Devices []*Device }
Information about a system's opencl platform and supported devices.
func GetPlatformInfo ¶
func GetPlatformInfo() ([]PlatformInfo, error)
Get information about supported opencl platforms and devices.
func (PlatformInfo) String ¶
func (pl PlatformInfo) String() string