Documentation
¶
Index ¶
- Constants
- Variables
- func ErrJoin(e1, e2 error) error
- func Init(version Version, paths ...string) error
- func InitializeGLSharing(paths ...string) error
- func SetHandle(handleExternal uintptr)
- func StatusToErr(code Status) error
- func Uninitialized(name string) error
- type Buffer
- type BufferData
- type BufferRect
- type BufferType
- type BuildProgramNotifyFuncType
- type CLGLObjectType
- type CLGLTextureInfo
- type CommandQueue
- type CommandQueueProperties
- type CommandQueueProperty
- type Context
- type ContextProperties
- type ContextProperty
- type CreateContextNotifyFuncType
- type Device
- type DeviceAffinityDomain
- type DeviceInfo
- type DevicePartition
- type DevicePartitionProperty
- type DeviceType
- type Event
- type EventCommandExecStatus
- type EventInfo
- type Extension
- type GLEnum
- type GLInt
- type GLUint
- type ImageChannelOrder
- type ImageChannelType
- type ImageData
- type ImageDesc
- type ImageFormat
- type ImageInfo
- type Kernel
- type KernelArg
- type KernelWorkGroupInfo
- type MapFlag
- type MapPointer
- type MemFlag
- type MemInfo
- type MemObjectType
- type PipeProperties
- type Platform
- type PlatformInfo
- type Program
- type ProgramBuildInfo
- type Sampler
- type Size
- type Status
- type Version
Constants ¶
View Source
const ( 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 clBuffer 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 clContext" 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 clBuffer 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
View Source
const ( // OpenCL Extension_khr_gl_sharing Extension = "cl_khr_gl_sharing" Extension_khr_fp64 Extension = "cl_khr_fp64" // Nvidia Extension_nv_pragma_unroll Extension = "cl_nv_pragma_unroll" Extension_nv_compiler_options Extension = "cl_nv_compiler_options" Version1_0 Version = "CL1.0" Version1_1 Version = "CL1.1" Version1_2 Version = "CL1.2" Version2_0 Version = "CL2.0" Version3_0 Version = "CL3.0" )
TODO: Not exhaustive
Variables ¶
View Source
var ( // GetPlatformIDs this wrap opencl clGetPlatformIDs and do returns a list of available OpenCL platforms GetPlatformIDs func(numEntries uint32, platforms []Platform, numPlatforms *uint32) Status = nil // GetPlatformInfo this wrap opencl clGetPlatformInfo and do queries information about a specific platform GetPlatformInfo func(platform Platform, platformInfo PlatformInfo, paramValueSize Size, paramValue []byte, paramValueSizeRet *Size) Status = nil // GetDeviceIDs this wrap opencl clGetDeviceIDs and do returns a list of available OpenCL devices GetDeviceIDs func(platform Platform, deviceType DeviceType, numEntries uint32, devices []Device, numDevices *uint32) Status = nil // GetDeviceInfo this wrap opencl clGetDeviceInfo and do queries information about a specific device GetDeviceInfo func(device Device, deviceInfo DeviceInfo, paramValueSize Size, paramValue []byte, paramValueSizeRet *Size) Status = nil // ReleaseDevice this wrap opencl clReleaseDevice and do releases the OpenCL device ReleaseDevice func(id Device) Status = nil // ReleaseEvent this wrap opencl clReleaseEvent and do releases an OpenCL event ReleaseEvent func(event Event) Status = nil // WaitForEvents this wrap opencl clWaitForEvents and do waits on the host thread for commands identified by num_events to complete WaitForEvents func(numEvents uint32, eventList []Event) Status = nil // CreateContext this wrap opencl clCreateContext and do creates an OpenCL context CreateContext func(properties unsafe.Pointer, numDevices uint32, devices []Device, pfnNotify *CreateContextNotifyFuncType, userData []byte, errCodeRet *Status) Context = nil // ReleaseContext this wrap opencl clReleaseContext and do releases the OpenCL context ReleaseContext func(ctx Context) Status = nil // CreateProgramWithSource this wrap opencl clCreateProgramWithSource and do creates a program object for a context CreateProgramWithSource func(ctx Context, count Size, strings []string, lengths []Size, errCodeRet *Status) Program = nil // CreateBuffer this wrap opencl clCreateBuffer and do creates a buffer object CreateBuffer func(ctx Context, memFlags MemFlag, size Size, hostPtr unsafe.Pointer, errCodeRet *Status) Buffer = nil // CreateImage this wrap opencl clCreateImage and do creates a image object CreateImage func(ctx Context, memFlags MemFlag, imageFormat *ImageFormat, desc *ImageDesc, hostPtr unsafe.Pointer, errCodeRet *Status) Buffer = nil // CreateImage2D this wrap opencl clCreateImage2D and do creates a 2D image object CreateImage2D func(ctx Context, memFlags MemFlag, imageFormat *ImageFormat, imageWidth, imageHeight, imageRowPitch Size, hostPtr unsafe.Pointer, errCodeRet *Status) Buffer = nil // CreateImage3D this wrap opencl clCreateImage3D and do creates a 3D image object CreateImage3D func(ctx Context, memFlags MemFlag, imageFormat *ImageFormat, imageWidth, imageHeight, imageDepth, imageRowPitch, imageSlicePitch Size, hostPtr unsafe.Pointer, errCodeRet *Status) Buffer = nil // CreateCommandQueue this wrap opencl clCreateCommandQueue and do creates a command-queue on a specific device CreateCommandQueue func(context Context, device Device, properties CommandQueueProperty, errCodeRet *Status) CommandQueue = nil // CreateCommandQueueWithProperties this wrap opencl clCreateCommandQueueWithProperties and do creates a command-queue on a specific device with specified properties CreateCommandQueueWithProperties func(context Context, device Device, properties CommandQueueProperty, errCodeRet *Status) CommandQueue = nil // EnqueueBarrier this wrap opencl clEnqueueBarrier and do inserts a barrier command EnqueueBarrier func(queue CommandQueue) Status = nil // EnqueueNDRangeKernel this wrap opencl clEnqueueNDRangeKernel and do enqueue a kernel to execute on a device EnqueueNDRangeKernel func(queue CommandQueue, kernel Kernel, workDim uint, globalWorkOffset, globalWorkSize, localWorkSize []Size, numEventsWaitList uint, eventWaitList []Event, event *Event) Status = nil // EnqueueReadBuffer this wrap opencl clEnqueueReadBuffer and do enqueue a command to read from a buffer object to host memory EnqueueReadBuffer func(queue CommandQueue, buffer Buffer, blockingRead bool, offset, cb Size, ptr unsafe.Pointer, numEventsWaitList uint, eventWaitList []Event, event *Event) Status = nil // EnqueueReadImage this wrap opencl clEnqueueReadImage and do enqueue a command to read from a 2D or 3D image object to host memory EnqueueReadImage func(queue CommandQueue, image Buffer, blockingRead bool, origin, region [3]Size, row_pitch, slice_pitch Size, ptr unsafe.Pointer, numEventsWaitList uint, eventWaitList []Event, event *Event) Status = nil // EnqueueWriteImage this wrap opencl clEnqueueWriteImage and do enqueue a command to write from host memory to a 2D or 3D image object EnqueueWriteImage func(queue CommandQueue, image Buffer, blockingRead bool, origin, region [3]Size, row_pitch, slice_pitch Size, ptr unsafe.Pointer, numEventsWaitList uint, eventWaitList []Event, event *Event) Status = nil // EnqueueWriteBuffer this wrap opencl clEnqueueWriteBuffer and do enqueue a command to write to a buffer object from host memory EnqueueWriteBuffer func(queue CommandQueue, buffer Buffer, blockingWrite bool, offset, cb Size, ptr unsafe.Pointer, numEventsWaitList uint, eventWaitList []Event, event *Event) Status = nil // EnqueueMapBuffer this wrap opencl clEnqueueMapBuffer and do enqueue a command to map a buffer object into the host address space EnqueueMapBuffer func(queue CommandQueue, buffer Buffer, blockingMap bool, mapFlags MapFlag, offset, size Size, numEventsWaitList uint, eventWaitList []Event, event *Event, errCodeRet *Status) uintptr = nil // EnqueueUnmapMemObject this wrap opencl clEnqueueUnmapMemObject and do enqueue a command to unmap a previously mapped buffer object EnqueueUnmapMemObject func(queue CommandQueue, buffer Buffer, mappedPtr unsafe.Pointer, numEventsWaitList uint, eventWaitList []Event, event *Event) Status = nil // EnqueueMapImage this wrap opencl clEnqueueMapImage and do enqueue a command to map a 2D or 3D image object into the host address space EnqueueMapImage func(queue CommandQueue, image Buffer, blockingMap bool, mapFlags MapFlag, origin, region [3]Size, imageRowPitch, imageSlicePitch *Size, numEventsWaitList uint, eventWaitList []Event, event *Event, errCodeRet *Status) uintptr = nil // FinishCommandQueue this wrap opencl clFinish and do issues all previously queued OpenCL commands in a command-queue to the device FinishCommandQueue func(queue CommandQueue) Status = nil // FlushCommandQueue this wrap opencl clFlush and do ensures that all previously queued OpenCL commands in a command-queue are submitted to the device FlushCommandQueue func(queue CommandQueue) Status = nil // ReleaseCommandQueue this wrap opencl clReleaseCommandQueue and do releases a kernel object ReleaseCommandQueue func(queue CommandQueue) Status = nil // BuildProgram this wrap opencl clBuildProgram and do builds (compiles & links) a program executable from the program source or binary BuildProgram func(program Program, numDevices uint32, devices []Device, options []byte, pfnNotify *BuildProgramNotifyFuncType, userData []byte) Status = nil // GetProgramBuildInfo this wrap opencl clGetProgramBuildInfo and do returns build information for each device in the program object GetProgramBuildInfo func(program Program, device Device, info ProgramBuildInfo, paramSize Size, paramValue unsafe.Pointer, paramSizeRet *Size) Status = nil // CreateKernel this wrap opencl clCreateKernel and do creates a kernel object CreateKernel func(program Program, kernelName string, errCodeRet *Status) Kernel = nil // ReleaseProgram this wrap opencl clReleaseProgram and do releases the OpenCL program object ReleaseProgram func(program Program) Status = nil // GetProgramInfo this wrap opencl clGetProgramInfo and do queries information about a program object GetProgramInfo func(program Program, info ProgramBuildInfo, size Size, pointer unsafe.Pointer, t *Size) Status = nil // SetKernelArg this wrap opencl clSetKernelArg and do sets the argument value for a specific argument of a kernel SetKernelArg func(kernel Kernel, argIndex uint32, argSize Size, argValue unsafe.Pointer) Status = nil // ReleaseKernel this wrap opencl clReleaseKernel and do releases a kernel object ReleaseKernel func(kernel Kernel) Status = nil // GetMemObjectInfo this wrap opencl clGetMemObjectInfo and do queries information about a memory object GetMemObjectInfo func(buffer Buffer, memInfo MemInfo, paramValueSize Size, paramValue unsafe.Pointer, paramValueSizeRet *Size) Status = nil // ReleaseMemObject this wrap opencl clReleaseMemObject and do releases an OpenCL memory object ReleaseMemObject func(buffer Buffer) Status = nil // CreateFromGLTexture this wrap opencl clCreateFromGLTexture and do creates a 2D image object from an OpenGL texture object CreateFromGLTexture func(ctx Context, memFlags MemFlag, textureTarget GLEnum, mipLevel GLInt, texture GLUint, errCodeRet *Status) Buffer = nil // GetGLObjectInfo this wrap opencl clGetGLObjectInfo and do returns information about the OpenCL memory object and OpenGL object GetGLObjectInfo func(memObj Buffer, objectType *CLGLObjectType, objectName *GLUint) Status = nil // GetGLTextureInfo this wrap opencl clGetGLTextureInfo and do returns information about the OpenGL texture object associated with a memory object GetGLTextureInfo func(memObj Buffer, paramName CLGLTextureInfo, paramValueSize Size, paramValue unsafe.Pointer, paramValueSizeRet *Size) Status = nil // EnqueueAcquireGLObjects this wrap opencl clEnqueueAcquireGLObjects and do enqueue commands to acquire OpenCL memory objects that have been created from OpenGL objects EnqueueAcquireGLObjects func(queue CommandQueue, numObjects uint32, memObjects unsafe.Pointer, numEventsInWaitList uint32, eventWaitList []Event, event *Event) Status = nil // EnqueueReleaseGLObjects this wrap opencl clEnqueueReleaseGLObjects and do enqueue commands to release OpenCL memory objects that have been created from OpenGL objects EnqueueReleaseGLObjects func(queue CommandQueue, numObjects uint32, memObjects unsafe.Pointer, numEventsInWaitList uint32, eventWaitList []Event, event *Event) Status = nil )
functions
Functions ¶
func InitializeGLSharing ¶
func StatusToErr ¶
func Uninitialized ¶
Types ¶
type BufferData ¶
func GetBufferData ¶
func GetBufferData[T BufferType](data []T) *BufferData
type BufferRect ¶
type BufferType ¶
type CLGLObjectType ¶
type CLGLObjectType uint32
type CLGLTextureInfo ¶
type CLGLTextureInfo uint32
type CommandQueue ¶
type CommandQueue uint
type CommandQueueProperties ¶
type CommandQueueProperties uint32
type CommandQueueProperty ¶
type CommandQueueProperty uint32
type ContextProperties ¶
type ContextProperty ¶
type ContextProperty uint
type CreateContextNotifyFuncType ¶
notify function types
type DeviceAffinityDomain ¶
type DeviceAffinityDomain uint64
type DeviceInfo ¶
type DeviceInfo uint32
type DevicePartition ¶
type DevicePartition struct {
Properties []DevicePartitionProperty
AffinityDomain DeviceAffinityDomain
}
type DevicePartitionProperty ¶
type DeviceType ¶
type DeviceType uint32
type EventCommandExecStatus ¶
type EventCommandExecStatus uint32
type ImageChannelOrder ¶
type ImageChannelOrder uint32
type ImageChannelType ¶
type ImageChannelType uint32
type ImageData ¶
type ImageData struct {
*BufferData
Origin [3]uint
Region [3]uint
RowPitch uint
SlicePitch uint
}
func GetImageBufferData ¶
type ImageDesc ¶
type ImageDesc struct {
Type MemObjectType
Width Size
Height Size
Depth Size
ArraySize Size
RowPitch Size
SlisePitch Size
Buffer Buffer
NumMipLevel uint32
NumSamples uint32
}
func CreateImageDesc ¶
func CreateImageDesc(imageType MemObjectType, imageWidth, imageHeight, imageDepth, imageArraySize, imageRowPitch, imageSlicePitch Size, numMipLevels, numSamples uint32, buffer Buffer) *ImageDesc
type ImageFormat ¶
type ImageFormat struct {
ChannelOrder ImageChannelOrder
ChannelType ImageChannelType
}
type KernelArg ¶
type KernelArg struct {
// contains filtered or unexported fields
}
structs
func NewKernelArg ¶
type KernelWorkGroupInfo ¶
type KernelWorkGroupInfo uint32
type MapPointer ¶
type MemObjectType ¶
type MemObjectType uint32
type PlatformInfo ¶
type PlatformInfo uint
type ProgramBuildInfo ¶
type ProgramBuildInfo uint32
Click to show internal directories.
Click to hide internal directories.