cl

package
v1.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2016 License: GPL-3.0 Imports: 7 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
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")
)
View Source
var (
	ErrUnknown = errors.New("cl: unknown error") // Generally an unexpected result from an OpenCL function (e.g. CL_SUCCESS but null pointer)
)
View Source
var ErrUnsupported = errors.New("cl: unsupported")

Functions

func WaitForEvents

func WaitForEvents(events []*Event) error

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

type BuildError struct {
	Message string
	Device  *Device
}

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 (q *CommandQueue) EnqueueFillBuffer(buffer *MemObject, pattern unsafe.Pointer, patternSize, offset, size int, eventWaitList []*Event) (*Event, error)

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 (q *CommandQueue) EnqueueReadBufferFloat32(buffer *MemObject, blocking bool, offset int, data []float32, eventWaitList []*Event) (*Event, error)

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 (q *CommandQueue) EnqueueWriteBufferFloat32(buffer *MemObject, blocking bool, offset int, data []float32, eventWaitList []*Event) (*Event, error)

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 CreateContext

func CreateContext(devices []*Device) (*Context, error)

TODO: properties

func (*Context) CreateBuffer

func (ctx *Context) CreateBuffer(flags MemFlag, data []byte) (*MemObject, error)

func (*Context) CreateBufferFloat32

func (ctx *Context) CreateBufferFloat32(flags MemFlag, data []float32) (*MemObject, error)

float64

func (*Context) CreateBufferUnsafe

func (ctx *Context) CreateBufferUnsafe(flags MemFlag, size int, dataPtr unsafe.Pointer) (*MemObject, error)

func (*Context) CreateCommandQueue

func (ctx *Context) CreateCommandQueue(device *Device, properties CommandQueueProperty) (*CommandQueue, error)

func (*Context) CreateEmptyBuffer

func (ctx *Context) CreateEmptyBuffer(flags MemFlag, size int) (*MemObject, error)

func (*Context) CreateEmptyBufferFloat32

func (ctx *Context) CreateEmptyBufferFloat32(flags MemFlag, size int) (*MemObject, error)

func (*Context) CreateProgramWithSource

func (ctx *Context) CreateProgramWithSource(sources []string) (*Program, error)

func (*Context) CreateUserEvent

func (ctx *Context) CreateUserEvent() (*Event, error)

func (*Context) GetSupportedImageFormats

func (ctx *Context) GetSupportedImageFormats(flags MemFlag, imageType MemObjectType) ([]ImageFormat, error)

func (*Context) Release

func (ctx *Context) Release()

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

func (d *Device) AddressBits() int

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) Available

func (d *Device) Available() bool

func (*Device) CompilerAvailable

func (d *Device) CompilerAvailable() bool

func (*Device) DoubleFPConfig

func (d *Device) DoubleFPConfig() FPConfig

Describes double precision floating-point capability of the OpenCL device

func (*Device) DriverVersion

func (d *Device) DriverVersion() string

func (*Device) EndianLittle

func (d *Device) EndianLittle() bool

func (*Device) ErrorCorrectionSupport

func (d *Device) ErrorCorrectionSupport() bool

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 (d *Device) Extensions() string

func (*Device) GetInfoString

func (d *Device) GetInfoString(param C.cl_device_info, panicOnError bool) (string, error)

func (*Device) GlobalMemCacheType

func (d *Device) GlobalMemCacheType() MemCacheType

func (*Device) GlobalMemCachelineSize

func (d *Device) GlobalMemCachelineSize() int

Size of global memory cache line in bytes.

func (*Device) GlobalMemSize

func (d *Device) GlobalMemSize() int64

Size of global device memory in bytes.

func (*Device) HalfFPConfig

func (d *Device) HalfFPConfig() FPConfig

Describes the OPTIONAL half precision floating-point capability of the OpenCL device

func (*Device) HostUnifiedMemory

func (d *Device) HostUnifiedMemory() bool

func (*Device) Image2DMaxHeight

func (d *Device) Image2DMaxHeight() int

Max height of 2D image in pixels. The minimum value is 8192 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE.

func (*Device) Image2DMaxWidth

func (d *Device) Image2DMaxWidth() int

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

func (d *Device) Image3DMaxDepth() int

Max depth of 3D image in pixels. The minimum value is 2048 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE.

func (*Device) Image3DMaxHeight

func (d *Device) Image3DMaxHeight() int

Max height of 3D image in pixels. The minimum value is 2048 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE.

func (*Device) Image3DMaxWidth

func (d *Device) Image3DMaxWidth() int

Max width of 3D image in pixels. The minimum value is 2048 if CL_DEVICE_IMAGE_SUPPORT is CL_TRUE.

func (*Device) ImageSupport

func (d *Device) ImageSupport() bool

func (*Device) LocalMemSize

func (d *Device) LocalMemSize() int64

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

func (d *Device) MaxClockFrequency() int

Maximum configured clock frequency of the device in MHz.

func (*Device) MaxComputeUnits

func (d *Device) MaxComputeUnits() int

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

func (d *Device) MaxConstantArgs() int

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

func (d *Device) MaxConstantBufferSize() int64

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

func (d *Device) MaxMemAllocSize() int64

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

func (d *Device) MaxParameterSize() int

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

func (d *Device) MaxReadImageArgs() int

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

func (d *Device) MaxSamplers() int

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

func (d *Device) MaxWorkGroupSize() int

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

func (d *Device) MaxWorkItemDimensions() int

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

func (d *Device) MaxWorkItemSizes() []int

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

func (d *Device) MaxWriteImageArgs() int

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

func (d *Device) MemBaseAddrAlign() int

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) Name

func (d *Device) Name() string

func (*Device) NativeVectorWidthChar

func (d *Device) NativeVectorWidthChar() int

func (*Device) NativeVectorWidthDouble

func (d *Device) NativeVectorWidthDouble() int

func (*Device) NativeVectorWidthFloat

func (d *Device) NativeVectorWidthFloat() int

func (*Device) NativeVectorWidthHalf

func (d *Device) NativeVectorWidthHalf() int

func (*Device) NativeVectorWidthInt

func (d *Device) NativeVectorWidthInt() int

func (*Device) NativeVectorWidthLong

func (d *Device) NativeVectorWidthLong() int

func (*Device) NativeVectorWidthShort

func (d *Device) NativeVectorWidthShort() int

func (*Device) OpenCLCVersion

func (d *Device) OpenCLCVersion() string

func (*Device) Profile

func (d *Device) Profile() string

func (*Device) ProfilingTimerResolution

func (d *Device) ProfilingTimerResolution() int

Describes the resolution of device timer. This is measured in nanoseconds.

func (*Device) Type

func (d *Device) Type() DeviceType

func (*Device) Vendor

func (d *Device) Vendor() string

func (*Device) Version

func (d *Device) Version() string

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 ErrOther

type ErrOther int

func (ErrOther) Error

func (e ErrOther) Error() string

type ErrUnsupportedArgumentType

type ErrUnsupportedArgumentType struct {
	Index int
	Value interface{}
}

func (ErrUnsupportedArgumentType) Error

type Event

type Event struct {
	// contains filtered or unexported fields
}

func (*Event) GetEventProfilingInfo

func (e *Event) GetEventProfilingInfo(paramName ProfilingInfo) (int64, error)

func (*Event) Release

func (e *Event) Release()

func (*Event) SetUserEventStatus

func (e *Event) SetUserEventStatus(status int) error

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
)

func (FPConfig) String

func (c FPConfig) String() string

type ImageFormat

type ImageFormat struct {
	ChannelOrder    ChannelOrder
	ChannelDataType ChannelDataType
}

type Kernel

type Kernel struct {
	// contains filtered or unexported fields
}

func (*Kernel) ArgName

func (k *Kernel) ArgName(index int) (string, error)

func (*Kernel) NumArgs

func (k *Kernel) NumArgs() (int, error)

func (*Kernel) PreferredWorkGroupSizeMultiple

func (k *Kernel) PreferredWorkGroupSizeMultiple(device *Device) (int, error)

func (*Kernel) Release

func (k *Kernel) Release()

func (*Kernel) SetArg

func (k *Kernel) SetArg(index int, arg interface{}) error

func (*Kernel) SetArgBuffer

func (k *Kernel) SetArgBuffer(index int, buffer *MemObject) error

func (*Kernel) SetArgFloat32

func (k *Kernel) SetArgFloat32(index int, val float32) error

func (*Kernel) SetArgInt32

func (k *Kernel) SetArgInt32(index int, val int32) error

func (*Kernel) SetArgInt8

func (k *Kernel) SetArgInt8(index int, val int8) error

func (*Kernel) SetArgLocal

func (k *Kernel) SetArgLocal(index int, size int) error

func (*Kernel) SetArgUint32

func (k *Kernel) SetArgUint32(index int, val uint32) error

func (*Kernel) SetArgUint64

func (k *Kernel) SetArgUint64(index int, val uint64) error

func (*Kernel) SetArgUint8

func (k *Kernel) SetArgUint8(index int, val uint8) error

func (*Kernel) SetArgUnsafe

func (k *Kernel) SetArgUnsafe(index, argSize int, arg unsafe.Pointer) error

func (*Kernel) SetArgs

func (k *Kernel) SetArgs(args ...interface{}) error

func (*Kernel) WorkGroupSize

func (k *Kernel) WorkGroupSize(device *Device) (int, error)

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 MemObject

type MemObject struct {
	// contains filtered or unexported fields
}

func (*MemObject) Release

func (b *MemObject) Release()

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

func GetPlatforms() ([]*Platform, error)

Obtain the list of platforms available.

func (*Platform) Extensions

func (p *Platform) Extensions() string

func (*Platform) GetDevices

func (p *Platform) GetDevices(deviceType DeviceType) ([]*Device, error)

func (*Platform) Name

func (p *Platform) Name() string

func (*Platform) Profile

func (p *Platform) Profile() string

func (*Platform) Vendor

func (p *Platform) Vendor() string

func (*Platform) Version

func (p *Platform) Version() string

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
}

func (*Program) BuildProgram

func (p *Program) BuildProgram(devices []*Device, options string) error

func (*Program) CreateKernel

func (p *Program) CreateKernel(name string) (*Kernel, error)

func (*Program) Release

func (p *Program) Release()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL