Documentation ¶
Overview ¶
Package cl provides a binding to the OpenCL api. It's mostly a low-level wrapper that avoids adding functionality while still making the interface a little more friendly and easy to use.
Resource life-cycle management:
For any CL object that gets created (buffer, queue, kernel, etc..) you should call object.Release() when finished with it to free the CL resources. This explicitely calls the related clXXXRelease method for the type. However, as a fallback there is a finalizer set for every resource item that takes care of it (eventually) if Release isn't called. In this way you can have better control over the life cycle of resources while having a fall back to avoid leaks. This is similar to how file handles and such are handled in the Go standard packages.
Index ¶
- Variables
- func WaitForEvents(events []*Event) error
- type BuildError
- type ChannelDataType
- type ChannelOrder
- type CommandQueue
- func (q *CommandQueue) EnqueueBarrierWithWaitList(eventWaitList []*Event) (*Event, error)
- func (q *CommandQueue) EnqueueCopyBuffer(srcBuffer, dstBuffer *MemObject, srcOffset, dstOffset, byteCount int, ...) (*Event, error)
- func (q *CommandQueue) EnqueueFillBuffer(buffer *MemObject, pattern unsafe.Pointer, patternSize, offset, size int, ...) (*Event, error)
- func (q *CommandQueue) EnqueueMapBuffer(buffer *MemObject, blocking bool, flags MapFlag, offset, size int, ...) (*MappedMemObject, *Event, error)
- func (q *CommandQueue) EnqueueMapImage(buffer *MemObject, blocking bool, flags MapFlag, origin, region [3]int, ...) (*MappedMemObject, *Event, error)
- func (q *CommandQueue) EnqueueMarkerWithWaitList(eventWaitList []*Event) (*Event, error)
- func (q *CommandQueue) EnqueueNDRangeKernel(kernel *Kernel, globalWorkOffset, globalWorkSize, localWorkSize []int, ...) (*Event, error)
- func (q *CommandQueue) EnqueueReadBuffer(buffer *MemObject, blocking bool, offset, dataSize int, dataPtr unsafe.Pointer, ...) (*Event, error)
- func (q *CommandQueue) EnqueueReadBufferFloat32(buffer *MemObject, blocking bool, offset int, data []float32, ...) (*Event, error)
- func (q *CommandQueue) EnqueueReadImage(image *MemObject, blocking bool, origin, region [3]int, ...) (*Event, error)
- func (q *CommandQueue) EnqueueUnmapMemObject(buffer *MemObject, mappedObj *MappedMemObject, eventWaitList []*Event) (*Event, error)
- func (q *CommandQueue) EnqueueWriteBuffer(buffer *MemObject, blocking bool, offset, dataSize int, dataPtr unsafe.Pointer, ...) (*Event, error)
- func (q *CommandQueue) EnqueueWriteBufferFloat32(buffer *MemObject, blocking bool, offset int, data []float32, ...) (*Event, error)
- func (q *CommandQueue) EnqueueWriteImage(image *MemObject, blocking bool, origin, region [3]int, ...) (*Event, error)
- func (q *CommandQueue) Finish() error
- func (q *CommandQueue) Flush() error
- func (q *CommandQueue) Release()
- type CommandQueueProperty
- type CommmandExecStatus
- type Context
- func (ctx *Context) CreateBuffer(flags MemFlag, data []byte) (*MemObject, error)
- func (ctx *Context) CreateBufferFloat32(flags MemFlag, data []float32) (*MemObject, error)
- func (ctx *Context) CreateBufferUnsafe(flags MemFlag, size int, dataPtr unsafe.Pointer) (*MemObject, error)
- func (ctx *Context) CreateCommandQueue(device *Device, properties CommandQueueProperty) (*CommandQueue, error)
- func (ctx *Context) CreateEmptyBuffer(flags MemFlag, size int) (*MemObject, error)
- func (ctx *Context) CreateEmptyBufferFloat32(flags MemFlag, size int) (*MemObject, error)
- func (ctx *Context) CreateProgramWithSource(sources []string) (*Program, error)
- func (ctx *Context) CreateUserEvent() (*Event, error)
- func (ctx *Context) GetSupportedImageFormats(flags MemFlag, imageType MemObjectType) ([]ImageFormat, error)
- func (ctx *Context) Release()
- type Device
- func (d *Device) AddressBits() int
- func (d *Device) Available() bool
- func (d *Device) CompilerAvailable() bool
- func (d *Device) DoubleFPConfig() FPConfig
- func (d *Device) DriverVersion() string
- func (d *Device) EndianLittle() bool
- func (d *Device) ErrorCorrectionSupport() bool
- func (d *Device) ExecutionCapabilities() ExecCapability
- func (d *Device) Extensions() string
- func (d *Device) GetInfoString(param C.cl_device_info, panicOnError bool) (string, error)
- func (d *Device) GlobalMemCacheType() MemCacheType
- func (d *Device) GlobalMemCachelineSize() int
- func (d *Device) GlobalMemSize() int64
- func (d *Device) HalfFPConfig() FPConfig
- func (d *Device) HostUnifiedMemory() bool
- func (d *Device) Image2DMaxHeight() int
- func (d *Device) Image2DMaxWidth() int
- func (d *Device) Image3DMaxDepth() int
- func (d *Device) Image3DMaxHeight() int
- func (d *Device) Image3DMaxWidth() int
- func (d *Device) ImageSupport() bool
- func (d *Device) LocalMemSize() int64
- func (d *Device) LocalMemType() LocalMemType
- func (d *Device) MaxClockFrequency() int
- func (d *Device) MaxComputeUnits() int
- func (d *Device) MaxConstantArgs() int
- func (d *Device) MaxConstantBufferSize() int64
- func (d *Device) MaxMemAllocSize() int64
- func (d *Device) MaxParameterSize() int
- func (d *Device) MaxReadImageArgs() int
- func (d *Device) MaxSamplers() int
- func (d *Device) MaxWorkGroupSize() int
- func (d *Device) MaxWorkItemDimensions() int
- func (d *Device) MaxWorkItemSizes() []int
- func (d *Device) MaxWriteImageArgs() int
- func (d *Device) MemBaseAddrAlign() int
- func (d *Device) Name() string
- func (d *Device) NativeVectorWidthChar() int
- func (d *Device) NativeVectorWidthDouble() int
- func (d *Device) NativeVectorWidthFloat() int
- func (d *Device) NativeVectorWidthHalf() int
- func (d *Device) NativeVectorWidthInt() int
- func (d *Device) NativeVectorWidthLong() int
- func (d *Device) NativeVectorWidthShort() int
- func (d *Device) OpenCLCVersion() string
- func (d *Device) Profile() string
- func (d *Device) ProfilingTimerResolution() int
- func (d *Device) Type() DeviceType
- func (d *Device) Vendor() string
- func (d *Device) Version() string
- type DeviceType
- type ErrOther
- type ErrUnsupportedArgumentType
- type Event
- type ExecCapability
- type FPConfig
- type ImageFormat
- type Kernel
- func (k *Kernel) ArgName(index int) (string, error)
- func (k *Kernel) NumArgs() (int, error)
- func (k *Kernel) PreferredWorkGroupSizeMultiple(device *Device) (int, error)
- func (k *Kernel) Release()
- func (k *Kernel) SetArg(index int, arg interface{}) error
- func (k *Kernel) SetArgBuffer(index int, buffer *MemObject) error
- func (k *Kernel) SetArgFloat32(index int, val float32) error
- func (k *Kernel) SetArgInt32(index int, val int32) error
- func (k *Kernel) SetArgInt8(index int, val int8) error
- func (k *Kernel) SetArgLocal(index int, size int) error
- func (k *Kernel) SetArgUint32(index int, val uint32) error
- func (k *Kernel) SetArgUint64(index int, val uint64) error
- func (k *Kernel) SetArgUint8(index int, val uint8) error
- func (k *Kernel) SetArgUnsafe(index, argSize int, arg unsafe.Pointer) error
- func (k *Kernel) SetArgs(args ...interface{}) error
- func (k *Kernel) WorkGroupSize(device *Device) (int, error)
- type LocalBuffer
- type LocalMemType
- type MapFlag
- type MappedMemObject
- type MemCacheType
- type MemFlag
- type MemObject
- type MemObjectType
- type Platform
- type ProfilingInfo
- type Program
Constants ¶
This section is empty.
Variables ¶
var ( ErrDeviceNotFound = errors.New("cl: Device Not Found") ErrDeviceNotAvailable = errors.New("cl: Device Not Available") ErrCompilerNotAvailable = errors.New("cl: Compiler Not Available") ErrMemObjectAllocationFailure = errors.New("cl: Mem Object Allocation Failure") ErrOutOfResources = errors.New("cl: Out Of Resources") ErrOutOfHostMemory = errors.New("cl: Out Of Host Memory") ErrProfilingInfoNotAvailable = errors.New("cl: Profiling Info Not Available") ErrMemCopyOverlap = errors.New("cl: Mem Copy Overlap") ErrImageFormatMismatch = errors.New("cl: Image Format Mismatch") ErrImageFormatNotSupported = errors.New("cl: Image Format Not Supported") ErrBuildProgramFailure = errors.New("cl: Build Program Failure") ErrMapFailure = errors.New("cl: Map Failure") ErrMisalignedSubBufferOffset = errors.New("cl: Misaligned Sub Buffer Offset") ErrExecStatusErrorForEventsInWaitList = errors.New("cl: Exec Status Error For Events In Wait List") ErrCompileProgramFailure = errors.New("cl: Compile Program Failure") ErrLinkerNotAvailable = errors.New("cl: Linker Not Available") ErrLinkProgramFailure = errors.New("cl: Link Program Failure") ErrDevicePartitionFailed = errors.New("cl: Device Partition Failed") ErrKernelArgInfoNotAvailable = errors.New("cl: Kernel Arg Info Not Available") ErrInvalidValue = errors.New("cl: Invalid Value") ErrInvalidDeviceType = errors.New("cl: Invalid Device Type") ErrInvalidPlatform = errors.New("cl: Invalid Platform") ErrInvalidDevice = errors.New("cl: Invalid Device") ErrInvalidContext = errors.New("cl: Invalid Context") ErrInvalidQueueProperties = errors.New("cl: Invalid Queue Properties") ErrInvalidCommandQueue = errors.New("cl: Invalid Command Queue") ErrInvalidHostPtr = errors.New("cl: Invalid Host Ptr") ErrInvalidMemObject = errors.New("cl: Invalid Mem Object") ErrInvalidImageFormatDescriptor = errors.New("cl: Invalid Image Format Descriptor") ErrInvalidImageSize = errors.New("cl: Invalid Image Size") ErrInvalidSampler = errors.New("cl: Invalid Sampler") ErrInvalidBinary = errors.New("cl: Invalid Binary") ErrInvalidBuildOptions = errors.New("cl: Invalid Build Options") ErrInvalidProgram = errors.New("cl: Invalid Program") ErrInvalidProgramExecutable = errors.New("cl: Invalid Program Executable") ErrInvalidKernelName = errors.New("cl: Invalid Kernel Name") ErrInvalidKernelDefinition = errors.New("cl: Invalid Kernel Definition") ErrInvalidKernel = errors.New("cl: Invalid Kernel") ErrInvalidArgIndex = errors.New("cl: Invalid Arg Index") ErrInvalidArgValue = errors.New("cl: Invalid Arg Value") ErrInvalidArgSize = errors.New("cl: Invalid Arg Size") ErrInvalidKernelArgs = errors.New("cl: Invalid Kernel Args") ErrInvalidWorkDimension = errors.New("cl: Invalid Work Dimension") ErrInvalidWorkGroupSize = errors.New("cl: Invalid Work Group Size") ErrInvalidWorkItemSize = errors.New("cl: Invalid Work Item Size") ErrInvalidGlobalOffset = errors.New("cl: Invalid Global Offset") ErrInvalidEventWaitList = errors.New("cl: Invalid Event Wait List") ErrInvalidEvent = errors.New("cl: Invalid Event") ErrInvalidOperation = errors.New("cl: Invalid Operation") ErrInvalidGlObject = errors.New("cl: Invalid Gl Object") ErrInvalidBufferSize = errors.New("cl: Invalid Buffer Size") ErrInvalidMipLevel = errors.New("cl: Invalid Mip Level") ErrInvalidGlobalWorkSize = errors.New("cl: Invalid Global Work Size") ErrInvalidProperty = errors.New("cl: Invalid Property") ErrInvalidImageDescriptor = errors.New("cl: Invalid Image Descriptor") ErrInvalidCompilerOptions = errors.New("cl: Invalid Compiler Options") ErrInvalidLinkerOptions = errors.New("cl: Invalid Linker Options") ErrInvalidDevicePartitionCount = errors.New("cl: Invalid Device Partition Count") )
var (
ErrUnknown = errors.New("cl: unknown error") // Generally an unexpected result from an OpenCL function (e.g. CL_SUCCESS but null pointer)
)
var ErrUnsupported = errors.New("cl: unsupported")
Functions ¶
func WaitForEvents ¶
Waits on the host thread for commands identified by event objects in events to complete. A command is considered complete if its execution status is CL_COMPLETE or a negative value. The events specified in event_list act as synchronization points.
If the cl_khr_gl_event extension is enabled, event objects can also be used to reflect the status of an OpenGL sync object. The sync object in turn refers to a fence command executing in an OpenGL command stream. This provides another method of coordinating sharing of buffers and images between OpenGL and OpenCL.
Types ¶
type BuildError ¶
func (BuildError) Error ¶
func (e BuildError) Error() string
type ChannelDataType ¶
type ChannelDataType int
const ( ChannelDataTypeSNormInt8 ChannelDataType = C.CL_SNORM_INT8 ChannelDataTypeSNormInt16 ChannelDataType = C.CL_SNORM_INT16 ChannelDataTypeUNormInt8 ChannelDataType = C.CL_UNORM_INT8 ChannelDataTypeUNormInt16 ChannelDataType = C.CL_UNORM_INT16 ChannelDataTypeUNormShort565 ChannelDataType = C.CL_UNORM_SHORT_565 ChannelDataTypeUNormShort555 ChannelDataType = C.CL_UNORM_SHORT_555 ChannelDataTypeUNormInt101010 ChannelDataType = C.CL_UNORM_INT_101010 ChannelDataTypeSignedInt8 ChannelDataType = C.CL_SIGNED_INT8 ChannelDataTypeSignedInt16 ChannelDataType = C.CL_SIGNED_INT16 ChannelDataTypeSignedInt32 ChannelDataType = C.CL_SIGNED_INT32 ChannelDataTypeUnsignedInt8 ChannelDataType = C.CL_UNSIGNED_INT8 ChannelDataTypeUnsignedInt16 ChannelDataType = C.CL_UNSIGNED_INT16 ChannelDataTypeUnsignedInt32 ChannelDataType = C.CL_UNSIGNED_INT32 ChannelDataTypeHalfFloat ChannelDataType = C.CL_HALF_FLOAT ChannelDataTypeFloat ChannelDataType = C.CL_FLOAT )
func (ChannelDataType) String ¶
func (ct ChannelDataType) String() string
type ChannelOrder ¶
type ChannelOrder int
const ( ChannelOrderR ChannelOrder = C.CL_R ChannelOrderA ChannelOrder = C.CL_A ChannelOrderRG ChannelOrder = C.CL_RG ChannelOrderRA ChannelOrder = C.CL_RA ChannelOrderRGB ChannelOrder = C.CL_RGB ChannelOrderRGBA ChannelOrder = C.CL_RGBA ChannelOrderBGRA ChannelOrder = C.CL_BGRA ChannelOrderARGB ChannelOrder = C.CL_ARGB ChannelOrderIntensity ChannelOrder = C.CL_INTENSITY ChannelOrderLuminance ChannelOrder = C.CL_LUMINANCE ChannelOrderRx ChannelOrder = C.CL_Rx ChannelOrderRGx ChannelOrder = C.CL_RGx ChannelOrderRGBx ChannelOrder = C.CL_RGBx )
func (ChannelOrder) String ¶
func (co ChannelOrder) String() string
type CommandQueue ¶
type CommandQueue struct {
// contains filtered or unexported fields
}
func (*CommandQueue) EnqueueBarrierWithWaitList ¶
func (q *CommandQueue) EnqueueBarrierWithWaitList(eventWaitList []*Event) (*Event, error)
A synchronization point that enqueues a barrier operation.
func (*CommandQueue) EnqueueCopyBuffer ¶
func (q *CommandQueue) EnqueueCopyBuffer(srcBuffer, dstBuffer *MemObject, srcOffset, dstOffset, byteCount int, eventWaitList []*Event) (*Event, error)
Enqueues a command to copy a buffer object to another buffer object.
func (*CommandQueue) EnqueueFillBuffer ¶
func (*CommandQueue) EnqueueMapBuffer ¶
func (q *CommandQueue) EnqueueMapBuffer(buffer *MemObject, blocking bool, flags MapFlag, offset, size int, eventWaitList []*Event) (*MappedMemObject, *Event, error)
Enqueues a command to map a region of the buffer object given by buffer into the host address space and returns a pointer to this mapped region.
func (*CommandQueue) EnqueueMapImage ¶
func (q *CommandQueue) EnqueueMapImage(buffer *MemObject, blocking bool, flags MapFlag, origin, region [3]int, eventWaitList []*Event) (*MappedMemObject, *Event, error)
Enqueues a command to map a region of an image object into the host address space and returns a pointer to this mapped region.
func (*CommandQueue) EnqueueMarkerWithWaitList ¶
func (q *CommandQueue) EnqueueMarkerWithWaitList(eventWaitList []*Event) (*Event, error)
Enqueues a marker command which waits for either a list of events to complete, or all previously enqueued commands to complete.
func (*CommandQueue) EnqueueNDRangeKernel ¶
func (q *CommandQueue) EnqueueNDRangeKernel(kernel *Kernel, globalWorkOffset, globalWorkSize, localWorkSize []int, eventWaitList []*Event) (*Event, error)
Enqueues a command to execute a kernel on a device.
func (*CommandQueue) EnqueueReadBuffer ¶
func (q *CommandQueue) EnqueueReadBuffer(buffer *MemObject, blocking bool, offset, dataSize int, dataPtr unsafe.Pointer, eventWaitList []*Event) (*Event, error)
Enqueue commands to read from a buffer object to host memory.
func (*CommandQueue) EnqueueReadBufferFloat32 ¶
func (*CommandQueue) EnqueueReadImage ¶
func (q *CommandQueue) EnqueueReadImage(image *MemObject, blocking bool, origin, region [3]int, rowPitch, slicePitch int, data []byte, eventWaitList []*Event) (*Event, error)
Enqueues a command to read from a 2D or 3D image object to host memory.
func (*CommandQueue) EnqueueUnmapMemObject ¶
func (q *CommandQueue) EnqueueUnmapMemObject(buffer *MemObject, mappedObj *MappedMemObject, eventWaitList []*Event) (*Event, error)
Enqueues a command to unmap a previously mapped region of a memory object.
func (*CommandQueue) EnqueueWriteBuffer ¶
func (q *CommandQueue) EnqueueWriteBuffer(buffer *MemObject, blocking bool, offset, dataSize int, dataPtr unsafe.Pointer, eventWaitList []*Event) (*Event, error)
Enqueue commands to write to a buffer object from host memory.
func (*CommandQueue) EnqueueWriteBufferFloat32 ¶
func (*CommandQueue) EnqueueWriteImage ¶
func (q *CommandQueue) EnqueueWriteImage(image *MemObject, blocking bool, origin, region [3]int, rowPitch, slicePitch int, data []byte, eventWaitList []*Event) (*Event, error)
Enqueues a command to write from a 2D or 3D image object to host memory.
func (*CommandQueue) Finish ¶
func (q *CommandQueue) Finish() error
Blocks until all previously queued OpenCL commands in a command-queue are issued to the associated device and have completed.
func (*CommandQueue) Flush ¶
func (q *CommandQueue) Flush() error
Issues all previously queued OpenCL commands in a command-queue to the device associated with the command-queue.
func (*CommandQueue) Release ¶
func (q *CommandQueue) Release()
Call clReleaseCommandQueue on the CommandQueue. Using the CommandQueue after Release will cause a panick.
type CommandQueueProperty ¶
type CommandQueueProperty int
const ( CommandQueueOutOfOrderExecModeEnable CommandQueueProperty = C.CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE CommandQueueProfilingEnable CommandQueueProperty = C.CL_QUEUE_PROFILING_ENABLE )
type CommmandExecStatus ¶
type CommmandExecStatus int
const ( CommmandExecStatusComplete CommmandExecStatus = C.CL_COMPLETE CommmandExecStatusRunning CommmandExecStatus = C.CL_RUNNING CommmandExecStatusSubmitted CommmandExecStatus = C.CL_SUBMITTED CommmandExecStatusQueued CommmandExecStatus = C.CL_QUEUED )
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func (*Context) CreateBuffer ¶
func (*Context) CreateBufferFloat32 ¶
float64
func (*Context) CreateBufferUnsafe ¶
func (*Context) CreateCommandQueue ¶
func (ctx *Context) CreateCommandQueue(device *Device, properties CommandQueueProperty) (*CommandQueue, error)
func (*Context) CreateEmptyBuffer ¶
func (*Context) CreateEmptyBufferFloat32 ¶
func (*Context) CreateProgramWithSource ¶
func (*Context) CreateUserEvent ¶
func (*Context) GetSupportedImageFormats ¶
func (ctx *Context) GetSupportedImageFormats(flags MemFlag, imageType MemObjectType) ([]ImageFormat, error)
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
func GetDevices ¶
func GetDevices(platform *Platform, deviceType DeviceType) ([]*Device, error)
Obtain the list of devices available on a platform. 'platform' refers to the platform returned by GetPlatforms or can be nil. If platform is nil, the behavior is implementation-defined.
func (*Device) AddressBits ¶
The default compute device address space size specified as an unsigned integer value in bits. Currently supported values are 32 or 64 bits.
func (*Device) CompilerAvailable ¶
func (*Device) DoubleFPConfig ¶
Describes double precision floating-point capability of the OpenCL device
func (*Device) DriverVersion ¶
func (*Device) EndianLittle ¶
func (*Device) ErrorCorrectionSupport ¶
Is CL_TRUE if the device implements error correction for all accesses to compute device memory (global and constant). Is CL_FALSE if the device does not implement such error correction.
func (*Device) ExecutionCapabilities ¶
func (d *Device) ExecutionCapabilities() ExecCapability
Describes the execution capabilities of the device. The mandated minimum capability is CL_EXEC_KERNEL.
func (*Device) Extensions ¶
func (*Device) GetInfoString ¶
func (*Device) GlobalMemCacheType ¶
func (d *Device) GlobalMemCacheType() MemCacheType
func (*Device) GlobalMemCachelineSize ¶
Size of global memory cache line in bytes.
func (*Device) GlobalMemSize ¶
Size of global device memory in bytes.
func (*Device) HalfFPConfig ¶
Describes the OPTIONAL half precision floating-point capability of the OpenCL device
func (*Device) HostUnifiedMemory ¶
func (*Device) Image2DMaxHeight ¶
Max height of 2D image in pixels. The minimum value is 8192 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE.
func (*Device) Image2DMaxWidth ¶
Max width of 2D image or 1D image not created from a buffer object in pixels. The minimum value is 8192 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE.
func (*Device) Image3DMaxDepth ¶
Max depth of 3D image in pixels. The minimum value is 2048 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE.
func (*Device) Image3DMaxHeight ¶
Max height of 3D image in pixels. The minimum value is 2048 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE.
func (*Device) Image3DMaxWidth ¶
Max width of 3D image in pixels. The minimum value is 2048 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE.
func (*Device) ImageSupport ¶
func (*Device) LocalMemSize ¶
Size of local memory arena in bytes. The minimum value is 32 KB for devices that are not of type CL_DEVICE_TYPE_CUSTOM.
func (*Device) LocalMemType ¶
func (d *Device) LocalMemType() LocalMemType
Type of local memory supported. This can be set to CL_LOCAL implying dedicated local memory storage such as SRAM, or CL_GLOBAL. For custom devices, CL_NONE can also be returned indicating no local memory support.
func (*Device) MaxClockFrequency ¶
Maximum configured clock frequency of the device in MHz.
func (*Device) MaxComputeUnits ¶
The number of parallel compute units on the OpenCL device. A work-group executes on a single compute unit. The minimum value is 1.
func (*Device) MaxConstantArgs ¶
Max number of arguments declared with the __constant qualifier in a kernel. The minimum value is 8 for devices that are not of type CL_DEVICE_TYPE_CUSTOM.
func (*Device) MaxConstantBufferSize ¶
Max size in bytes of a constant buffer allocation. The minimum value is 64 KB for devices that are not of type CL_DEVICE_TYPE_CUSTOM.
func (*Device) MaxMemAllocSize ¶
Max size of memory object allocation in bytes. The minimum value is max (1/4th of CL_DEVICE_GLOBAL_MEM_SIZE, 128*1024*1024) for devices that are not of type CL_DEVICE_TYPE_CUSTOM.
func (*Device) MaxParameterSize ¶
Max size in bytes of the arguments that can be passed to a kernel. The minimum value is 1024 for devices that are not of type CL_DEVICE_TYPE_CUSTOM. For this minimum value, only a maximum of 128 arguments can be passed to a kernel.
func (*Device) MaxReadImageArgs ¶
Max number of simultaneous image objects that can be read by a kernel. The minimum value is 128 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE.
func (*Device) MaxSamplers ¶
Maximum number of samplers that can be used in a kernel. The minimum value is 16 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE. (Also see sampler_t.)
func (*Device) MaxWorkGroupSize ¶
Maximum number of work-items in a work-group executing a kernel on a single compute unit, using the data parallel execution model. (Refer to clEnqueueNDRangeKernel). The minimum value is 1.
func (*Device) MaxWorkItemDimensions ¶
Maximum dimensions that specify the global and local work-item IDs used by the data parallel execution model. (Refer to clEnqueueNDRangeKernel). The minimum value is 3 for devices that are not of type CL_DEVICE_TYPE_CUSTOM.
func (*Device) MaxWorkItemSizes ¶
Maximum number of work-items that can be specified in each dimension of the work-group to clEnqueueNDRangeKernel.
Returns n size_t entries, where n is the value returned by the query for CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS.
The minimum value is (1, 1, 1) for devices that are not of type CL_DEVICE_TYPE_CUSTOM.
func (*Device) MaxWriteImageArgs ¶
Max number of simultaneous image objects that can be written to by a kernel. The minimum value is 8 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE.
func (*Device) MemBaseAddrAlign ¶
The minimum value is the size (in bits) of the largest OpenCL built-in data type supported by the device (long16 in FULL profile, long16 or int16 in EMBEDDED profile) for devices that are not of type CL_DEVICE_TYPE_CUSTOM.
func (*Device) NativeVectorWidthChar ¶
func (*Device) NativeVectorWidthDouble ¶
func (*Device) NativeVectorWidthFloat ¶
func (*Device) NativeVectorWidthHalf ¶
func (*Device) NativeVectorWidthInt ¶
func (*Device) NativeVectorWidthLong ¶
func (*Device) NativeVectorWidthShort ¶
func (*Device) OpenCLCVersion ¶
func (*Device) ProfilingTimerResolution ¶
Describes the resolution of device timer. This is measured in nanoseconds.
func (*Device) Type ¶
func (d *Device) Type() DeviceType
type DeviceType ¶
type DeviceType uint
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 )
func (DeviceType) String ¶
func (dt DeviceType) String() string
type ErrUnsupportedArgumentType ¶
type ErrUnsupportedArgumentType struct { Index int Value interface{} }
func (ErrUnsupportedArgumentType) Error ¶
func (e ErrUnsupportedArgumentType) Error() string
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
func (*Event) GetEventProfilingInfo ¶
func (e *Event) GetEventProfilingInfo(paramName ProfilingInfo) (int64, error)
func (*Event) SetUserEventStatus ¶
Sets the execution status of a user event object.
`status` specifies the new execution status to be set and can be CL_COMPLETE or a negative integer value to indicate an error. A negative integer value causes all enqueued commands that wait on this user event to be terminated. clSetUserEventStatus can only be called once to change the execution status of event.
type ExecCapability ¶
type ExecCapability int
const ( ExecCapabilityKernel ExecCapability = C.CL_EXEC_KERNEL // The OpenCL device can execute OpenCL kernels. ExecCapabilityNativeKernel ExecCapability = C.CL_EXEC_NATIVE_KERNEL // The OpenCL device can execute native kernels. )
func (ExecCapability) String ¶
func (ec ExecCapability) String() string
type FPConfig ¶
type FPConfig int
const ( FPConfigDenorm FPConfig = C.CL_FP_DENORM // denorms are supported FPConfigInfNaN FPConfig = C.CL_FP_INF_NAN // INF and NaNs are supported FPConfigRoundToNearest FPConfig = C.CL_FP_ROUND_TO_NEAREST // round to nearest even rounding mode supported FPConfigRoundToZero FPConfig = C.CL_FP_ROUND_TO_ZERO // round to zero rounding mode supported FPConfigRoundToInf FPConfig = C.CL_FP_ROUND_TO_INF // round to positive and negative infinity rounding modes supported FPConfigFMA FPConfig = C.CL_FP_FMA // IEEE754-2008 fused multiply-add is supported FPConfigSoftFloat FPConfig = C.CL_FP_SOFT_FLOAT // Basic floating-point operations (such as addition, subtraction, multiplication) are implemented in software )
type ImageFormat ¶
type ImageFormat struct { ChannelOrder ChannelOrder ChannelDataType ChannelDataType }
type Kernel ¶
type Kernel struct {
// contains filtered or unexported fields
}
func (*Kernel) PreferredWorkGroupSizeMultiple ¶
func (*Kernel) SetArgUnsafe ¶
type LocalBuffer ¶
type LocalBuffer int
type LocalMemType ¶
type LocalMemType int
const ( LocalMemTypeNone LocalMemType = C.CL_NONE LocalMemTypeGlobal LocalMemType = C.CL_GLOBAL LocalMemTypeLocal LocalMemType = C.CL_LOCAL )
func (LocalMemType) String ¶
func (t LocalMemType) String() string
type MapFlag ¶
type MapFlag int
const ( // This flag specifies that the region being mapped in the memory object is being mapped for reading. MapFlagRead MapFlag = C.CL_MAP_READ MapFlagWrite MapFlag = C.CL_MAP_WRITE MapFlagWriteInvalidateRegion MapFlag = C.CL_MAP_WRITE_INVALIDATE_REGION )
type MappedMemObject ¶
type MappedMemObject struct {
// contains filtered or unexported fields
}
func (*MappedMemObject) ByteSlice ¶
func (mb *MappedMemObject) ByteSlice() []byte
func (*MappedMemObject) Ptr ¶
func (mb *MappedMemObject) Ptr() unsafe.Pointer
func (*MappedMemObject) RowPitch ¶
func (mb *MappedMemObject) RowPitch() int
func (*MappedMemObject) Size ¶
func (mb *MappedMemObject) Size() int
func (*MappedMemObject) SlicePitch ¶
func (mb *MappedMemObject) SlicePitch() int
type MemCacheType ¶
type MemCacheType int
const ( MemCacheTypeNone MemCacheType = C.CL_NONE MemCacheTypeReadOnlyCache MemCacheType = C.CL_READ_ONLY_CACHE MemCacheTypeReadWriteCache MemCacheType = C.CL_READ_WRITE_CACHE )
func (MemCacheType) String ¶
func (ct MemCacheType) String() string
type MemFlag ¶
type MemFlag int
const ( MemReadWrite MemFlag = C.CL_MEM_READ_WRITE MemWriteOnly MemFlag = C.CL_MEM_WRITE_ONLY MemReadOnly MemFlag = C.CL_MEM_READ_ONLY MemUseHostPtr MemFlag = C.CL_MEM_USE_HOST_PTR MemAllocHostPtr MemFlag = C.CL_MEM_ALLOC_HOST_PTR MemCopyHostPtr MemFlag = C.CL_MEM_COPY_HOST_PTR MemWriteOnlyHost MemFlag = C.CL_MEM_HOST_WRITE_ONLY MemReadOnlyHost MemFlag = C.CL_MEM_HOST_READ_ONLY MemNoAccessHost MemFlag = C.CL_MEM_HOST_NO_ACCESS )
type MemObjectType ¶
type MemObjectType int
const ( MemObjectTypeBuffer MemObjectType = C.CL_MEM_OBJECT_BUFFER MemObjectTypeImage2D MemObjectType = C.CL_MEM_OBJECT_IMAGE2D MemObjectTypeImage3D MemObjectType = C.CL_MEM_OBJECT_IMAGE3D )
type Platform ¶
type Platform struct {
// contains filtered or unexported fields
}
func GetPlatforms ¶
Obtain the list of platforms available.
func (*Platform) Extensions ¶
func (*Platform) GetDevices ¶
func (p *Platform) GetDevices(deviceType DeviceType) ([]*Device, error)
type ProfilingInfo ¶
type ProfilingInfo int
const ( // A 64-bit value that describes the current device time counter in // nanoseconds when the command identified by event is enqueued in // a command-queue by the host. ProfilingInfoCommandQueued ProfilingInfo = C.CL_PROFILING_COMMAND_QUEUED // A 64-bit value that describes the current device time counter in // nanoseconds when the command identified by event that has been // enqueued is submitted by the host to the device associated with the command-queue. ProfilingInfoCommandSubmit ProfilingInfo = C.CL_PROFILING_COMMAND_SUBMIT // A 64-bit value that describes the current device time counter in // nanoseconds when the command identified by event starts execution on the device. ProfilingInfoCommandStart ProfilingInfo = C.CL_PROFILING_COMMAND_START // A 64-bit value that describes the current device time counter in // nanoseconds when the command identified by event has finished // execution on the device. ProfilingInfoCommandEnd ProfilingInfo = C.CL_PROFILING_COMMAND_END )
type Program ¶
type Program struct {
// contains filtered or unexported fields
}