cl

package
v0.0.0-...-e25c500 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	R         channelOrder = C.CL_R
	A         channelOrder = C.CL_A
	RG        channelOrder = C.CL_RG
	RA        channelOrder = C.CL_RA
	RGB       channelOrder = C.CL_RGB
	RGBA      channelOrder = C.CL_RGBA
	BGRA      channelOrder = C.CL_BGRA
	ARGB      channelOrder = C.CL_ARGB
	INTENSITY channelOrder = C.CL_INTENSITY
	LUMINANCE channelOrder = C.CL_LUMINANCE
	Rx        channelOrder = C.CL_Rx
	RGx       channelOrder = C.CL_RGx
	RGBx      channelOrder = C.CL_RGBx
)
View Source
const (
	FLOAT            channelType = C.CL_FLOAT
	HALF_FLOAT       channelType = C.CL_HALF_FLOAT
	SIGNED_INT8      channelType = C.CL_SIGNED_INT8
	SIGNED_INT16     channelType = C.CL_SIGNED_INT16
	SIGNED_INT32     channelType = C.CL_SIGNED_INT32
	SNORM_INT8       channelType = C.CL_SNORM_INT8
	SNORM_INT16      channelType = C.CL_SNORM_INT16
	UNORM_INT8       channelType = C.CL_UNORM_INT8
	UNORM_INT16      channelType = C.CL_UNORM_INT16
	UNORM_SHORT_565  channelType = C.CL_UNORM_SHORT_565
	UNORM_SHORT_555  channelType = C.CL_UNORM_SHORT_555
	UNORM_INT_101010 channelType = C.CL_UNORM_INT_101010
	UNSIGNED_INT8    channelType = C.CL_UNSIGNED_INT8
	UNSIGNED_INT16   channelType = C.CL_UNSIGNED_INT16
	UNSIGNED_INT32   channelType = C.CL_UNSIGNED_INT32
)

Variables

View Source
var Platforms []Platform

Functions

This section is empty.

Types

type AddressingMode

type AddressingMode C.cl_addressing_mode
const (
	ADDRESS_NONE            AddressingMode = C.CL_ADDRESS_NONE
	ADDRESS_CLAMP_TO_EDGE   AddressingMode = C.CL_ADDRESS_CLAMP_TO_EDGE
	ADDRESS_CLAMP           AddressingMode = C.CL_ADDRESS_CLAMP
	ADDRESS_REPEAT          AddressingMode = C.CL_ADDRESS_REPEAT
	ADDRESS_MIRRORED_REPEAT AddressingMode = C.CL_ADDRESS_MIRRORED_REPEAT
)

type Buffer

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

type BuildProperty

type BuildProperty C.cl_program_build_info
const (
	//BUILD_STATUS  BuildProperty = C.CL_PROGRAM_BUILD_STATUS
	BUILD_OPTIONS BuildProperty = C.CL_PROGRAM_BUILD_OPTIONS
	BUILD_LOG     BuildProperty = C.CL_PROGRAM_BUILD_LOG
)

type BuildStatus

type BuildStatus C.cl_build_status
const (
	BUILD_NONE        BuildStatus = C.CL_BUILD_NONE
	BUILD_ERROR       BuildStatus = C.CL_BUILD_ERROR
	BUILD_SUCCESS     BuildStatus = C.CL_BUILD_SUCCESS
	BUILD_IN_PROGRESS BuildStatus = C.CL_BUILD_IN_PROGRESS
)

func (BuildStatus) String

func (status BuildStatus) String() string

type Cl_error

type Cl_error C.cl_int

func (Cl_error) Error

func (e Cl_error) Error() string

type CommandQueue

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

func (*CommandQueue) EnqueueKernel

func (cq *CommandQueue) EnqueueKernel(k *Kernel, offset, gsize, lsize []Size) error

func (*CommandQueue) EnqueueReadBuffer

func (cq *CommandQueue) EnqueueReadBuffer(buf *Buffer, offset uint32, size uint32) ([]byte, error)

func (*CommandQueue) EnqueueReadImage

func (cq *CommandQueue) EnqueueReadImage(i *Image, blocking bool, origin, region [3]Size, rowPitch, slicePitch Size) ([]byte, error)

func (*CommandQueue) EnqueueWriteBuffer

func (cq *CommandQueue) EnqueueWriteBuffer(buf *Buffer, data []byte, offset uint32) error

func (*CommandQueue) EnqueueWriteImage

func (cq *CommandQueue) EnqueueWriteImage(img *Image, blocking bool, origin, region [3]Size, rowPitch, slicePitch Size, data []byte) error

type CommandQueueParameter

type CommandQueueParameter C.cl_command_queue_properties
const (
	QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE CommandQueueParameter = C.CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE
	QUEUE_PROFILING_ENABLE              CommandQueueParameter = C.CL_QUEUE_PROFILING_ENABLE
	QUEUE_NIL                           CommandQueueParameter = 0
)

type Context

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

func NewContextOfDevices

func NewContextOfDevices(params map[ContextParameter]interface{}, devices []Device) (*Context, error)

func NewContextOfType

func NewContextOfType(params map[ContextParameter]interface{}, t DeviceType) (*Context, error)

func (*Context) NewBuffer

func (c *Context) NewBuffer(flags MemoryFlags, size uint32) (*Buffer, error)

func (*Context) NewCommandQueue

func (c *Context) NewCommandQueue(device Device, param CommandQueueParameter) (*CommandQueue, error)

func (*Context) NewImage2D

func (c *Context) NewImage2D(flags MemoryFlags, format ImageFormat, width, height, rowPitch uint32, data *byte) (*Image, error)

func (*Context) NewImage3D

func (c *Context) NewImage3D(flags MemoryFlags, format ImageFormat, width, height, depth, rowPitch, slicePitch uint32, data *byte) (*Image, error)

func (*Context) NewProgramFromFile

func (c *Context) NewProgramFromFile(filename string) (*Program, error)

func (*Context) NewProgramFromSource

func (c *Context) NewProgramFromSource(prog []byte) (*Program, error)

func (*Context) NewSampler

func (c *Context) NewSampler(normalizedCoords bool, addressingMode AddressingMode, filterMode FilterMode) (*Sampler, error)

func (*Context) Property

func (c *Context) Property(prop ContextProperty) interface{}

type ContextParameter

type ContextParameter C.cl_context_properties
const (
	CONTEXT_PLATFORM ContextParameter = C.CL_CONTEXT_PLATFORM
)

type ContextProperty

type ContextProperty C.cl_context_info
const (
	CONTEXT_REFERENCE_COUNT ContextProperty = C.CL_CONTEXT_REFERENCE_COUNT
	CONTEXT_NUM_DEVICES     ContextProperty = C.CL_CONTEXT_NUM_DEVICES
	CONTEXT_DEVICES         ContextProperty = C.CL_CONTEXT_DEVICES
	CONTEXT_PROPERTIES      ContextProperty = C.CL_CONTEXT_PROPERTIES
)

func ContextProperties

func ContextProperties() []ContextProperty

type Device

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

func (*Device) Property

func (d *Device) Property(prop DeviceProperty) interface{}

type DeviceProperty

type DeviceProperty C.cl_device_info
const (
	DEVICE_ADDRESS_BITS DeviceProperty = C.CL_DEVICE_ADDRESS_BITS
	DEVICE_AVAILABLE    DeviceProperty = C.CL_DEVICE_AVAILABLE
	//DEVICE_BUILT_IN_KERNELS DeviceProperty = C.CL_DEVICE_BUILT_IN_KERNELS
	DEVICE_COMPILER_AVAILABLE DeviceProperty = C.CL_DEVICE_COMPILER_AVAILABLE
	//DEVICE_DOUBLE_FP_CONFIG          DeviceProperty = C.CL_DEVICE_DOUBLE_FP_CONFIG
	DEVICE_ENDIAN_LITTLE             DeviceProperty = C.CL_DEVICE_ENDIAN_LITTLE
	DEVICE_ERROR_CORRECTION_SUPPORT  DeviceProperty = C.CL_DEVICE_ERROR_CORRECTION_SUPPORT
	DEVICE_EXECUTION_CAPABILITIES    DeviceProperty = C.CL_DEVICE_EXECUTION_CAPABILITIES
	DEVICE_EXTENSIONS                DeviceProperty = C.CL_DEVICE_EXTENSIONS
	DEVICE_GLOBAL_MEM_CACHE_SIZE     DeviceProperty = C.CL_DEVICE_GLOBAL_MEM_CACHE_SIZE
	DEVICE_GLOBAL_MEM_CACHE_TYPE     DeviceProperty = C.CL_DEVICE_GLOBAL_MEM_CACHE_TYPE
	DEVICE_GLOBAL_MEM_CACHELINE_SIZE DeviceProperty = C.CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE
	DEVICE_GLOBAL_MEM_SIZE           DeviceProperty = C.CL_DEVICE_GLOBAL_MEM_SIZE
	//DEVICE_HALF_FP_CONFIG                DeviceProperty = C.CL_DEVICE_HALF_FP_CONFIG
	DEVICE_HOST_UNIFIED_MEMORY DeviceProperty = C.CL_DEVICE_HOST_UNIFIED_MEMORY
	DEVICE_IMAGE_SUPPORT       DeviceProperty = C.CL_DEVICE_IMAGE_SUPPORT
	DEVICE_IMAGE2D_MAX_HEIGHT  DeviceProperty = C.CL_DEVICE_IMAGE2D_MAX_HEIGHT
	DEVICE_IMAGE2D_MAX_WIDTH   DeviceProperty = C.CL_DEVICE_IMAGE2D_MAX_WIDTH
	DEVICE_IMAGE3D_MAX_DEPTH   DeviceProperty = C.CL_DEVICE_IMAGE3D_MAX_DEPTH
	DEVICE_IMAGE3D_MAX_HEIGHT  DeviceProperty = C.CL_DEVICE_IMAGE3D_MAX_HEIGHT
	DEVICE_IMAGE3D_MAX_WIDTH   DeviceProperty = C.CL_DEVICE_IMAGE3D_MAX_WIDTH
	//DEVICE_IMAGE_MAX_BUFFER_SIZE      DeviceProperty = C.CL_DEVICE_IMAGE_MAX_BUFFER_SIZE
	//DEVICE_IMAGE_MAX_ARRAY_SIZE       DeviceProperty = C.CL_DEVICE_IMAGE_MAX_ARRAY_SIZE
	//DEVICE_LINKER_AVAILABLE           DeviceProperty = C.CL_DEVICE_LINKER_AVAILABLE
	DEVICE_LOCAL_MEM_SIZE             DeviceProperty = C.CL_DEVICE_LOCAL_MEM_SIZE
	DEVICE_LOCAL_MEM_TYPE             DeviceProperty = C.CL_DEVICE_LOCAL_MEM_TYPE
	DEVICE_MAX_CLOCK_FREQUENCY        DeviceProperty = C.CL_DEVICE_MAX_CLOCK_FREQUENCY
	DEVICE_MAX_COMPUTE_UNITS          DeviceProperty = C.CL_DEVICE_MAX_COMPUTE_UNITS
	DEVICE_MAX_CONSTANT_ARGS          DeviceProperty = C.CL_DEVICE_MAX_CONSTANT_ARGS
	DEVICE_MAX_CONSTANT_BUFFER_SIZE   DeviceProperty = C.CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE
	DEVICE_MAX_MEM_ALLOC_SIZE         DeviceProperty = C.CL_DEVICE_MAX_MEM_ALLOC_SIZE
	DEVICE_MAX_PARAMETER_SIZE         DeviceProperty = C.CL_DEVICE_MAX_PARAMETER_SIZE
	DEVICE_MAX_READ_IMAGE_ARGS        DeviceProperty = C.CL_DEVICE_MAX_READ_IMAGE_ARGS
	DEVICE_MAX_SAMPLERS               DeviceProperty = C.CL_DEVICE_MAX_SAMPLERS
	DEVICE_MAX_WORK_GROUP_SIZE        DeviceProperty = C.CL_DEVICE_MAX_WORK_GROUP_SIZE
	DEVICE_MAX_WORK_ITEM_DIMENSIONS   DeviceProperty = C.CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS
	DEVICE_MAX_WORK_ITEM_SIZES        DeviceProperty = C.CL_DEVICE_MAX_WORK_ITEM_SIZES
	DEVICE_MAX_WRITE_IMAGE_ARGS       DeviceProperty = C.CL_DEVICE_MAX_WRITE_IMAGE_ARGS
	DEVICE_MEM_BASE_ADDR_ALIGN        DeviceProperty = C.CL_DEVICE_MEM_BASE_ADDR_ALIGN
	DEVICE_MIN_DATA_TYPE_ALIGN_SIZE   DeviceProperty = C.CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE
	DEVICE_NAME                       DeviceProperty = C.CL_DEVICE_NAME
	DEVICE_NATIVE_VECTOR_WIDTH_CHAR   DeviceProperty = C.CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR
	DEVICE_NATIVE_VECTOR_WIDTH_SHORT  DeviceProperty = C.CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT
	DEVICE_NATIVE_VECTOR_WIDTH_INT    DeviceProperty = C.CL_DEVICE_NATIVE_VECTOR_WIDTH_INT
	DEVICE_NATIVE_VECTOR_WIDTH_LONG   DeviceProperty = C.CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG
	DEVICE_NATIVE_VECTOR_WIDTH_FLOAT  DeviceProperty = C.CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT
	DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE DeviceProperty = C.CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE
	DEVICE_NATIVE_VECTOR_WIDTH_HALF   DeviceProperty = C.CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF
	DEVICE_OPENCL_C_VERSION           DeviceProperty = C.CL_DEVICE_OPENCL_C_VERSION
	//DEVICE_PARENT_DEVICE              DeviceProperty = C.CL_DEVICE_PARENT_DEVICE
	//DEVICE_PARTITION_MAX_SUB_DEVICES     DeviceProperty = C.CL_DEVICE_PARTITION_MAX_SUB_DEVICES
	//DEVICE_PARTITION_PROPERTIES          DeviceProperty = C.CL_DEVICE_PARTITION_PROPERTIES
	//DEVICE_PARTITION_AFFINITY_DOMAIN     DeviceProperty = C.CL_DEVICE_PARTITION_AFFINITY_DOMAIN
	//DEVICE_PARTITION_TYPE                DeviceProperty = C.CL_DEVICE_PARTITION_TYPE
	DEVICE_PLATFORM                      DeviceProperty = C.CL_DEVICE_PLATFORM
	DEVICE_PREFERRED_VECTOR_WIDTH_CHAR   DeviceProperty = C.CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR
	DEVICE_PREFERRED_VECTOR_WIDTH_SHORT  DeviceProperty = C.CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT
	DEVICE_PREFERRED_VECTOR_WIDTH_INT    DeviceProperty = C.CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT
	DEVICE_PREFERRED_VECTOR_WIDTH_LONG   DeviceProperty = C.CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG
	DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT  DeviceProperty = C.CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT
	DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE DeviceProperty = C.CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE
	DEVICE_PREFERRED_VECTOR_WIDTH_HALF   DeviceProperty = C.CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF
	//DEVICE_PRINTF_BUFFER_SIZE            DeviceProperty = C.CL_DEVICE_PRINTF_BUFFER_SIZE
	//DEVICE_PREFERRED_INTEROP_USER_SYNC   DeviceProperty = C.CL_DEVICE_PREFERRED_INTEROP_USER_SYNC
	DEVICE_PROFILE                    DeviceProperty = C.CL_DEVICE_PROFILE
	DEVICE_PROFILING_TIMER_RESOLUTION DeviceProperty = C.CL_DEVICE_PROFILING_TIMER_RESOLUTION
	DEVICE_QUEUE_PROPERTIES           DeviceProperty = C.CL_DEVICE_QUEUE_PROPERTIES
	//DEVICE_REFERENCE_COUNT            DeviceProperty = C.CL_DEVICE_REFERENCE_COUNT
	DEVICE_SINGLE_FP_CONFIG DeviceProperty = C.CL_DEVICE_SINGLE_FP_CONFIG
	DEVICE_TYPE             DeviceProperty = C.CL_DEVICE_TYPE
	DEVICE_VENDOR           DeviceProperty = C.CL_DEVICE_VENDOR
	DEVICE_VENDOR_ID        DeviceProperty = C.CL_DEVICE_VENDOR_ID
	DEVICE_VERSION          DeviceProperty = C.CL_DEVICE_VERSION
	DRIVER_VERSION          DeviceProperty = C.CL_DRIVER_VERSION
)

type DeviceType

type DeviceType C.cl_device_type
const (
	DEVICE_TYPE_DEFAULT     DeviceType = C.CL_DEVICE_TYPE_DEFAULT
	DEVICE_TYPE_CPU         DeviceType = C.CL_DEVICE_TYPE_CPU
	DEVICE_TYPE_GPU         DeviceType = C.CL_DEVICE_TYPE_GPU
	DEVICE_TYPE_ACCELERATOR DeviceType = C.CL_DEVICE_TYPE_ACCELERATOR
	//DEVICE_TYPE_CUSTOM      DeviceType = C.CL_DEVICE_TYPE_CUSTOM
	DEVICE_TYPE_ALL DeviceType = C.CL_DEVICE_TYPE_ALL
)

func (DeviceType) String

func (t DeviceType) String() string

type FilterMode

type FilterMode C.cl_filter_mode
const (
	FILTER_NEAREST FilterMode = C.CL_FILTER_NEAREST
	FILTER_LINEAR  FilterMode = C.CL_FILTER_LINEAR
)

type Image

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

func (*Image) Format

func (i *Image) Format() ImageFormat

func (*Image) Property

func (i *Image) Property(prop ImageProperty) Size

type ImageFormat

type ImageFormat struct {
	ChannelOrder    channelOrder
	ChannelDataType channelType
}

type ImageProperty

type ImageProperty C.cl_image_info
const (
	//IMAGE_FORMAT       ImageProperty = C.CL_IMAGE_FORMAT
	IMAGE_ELEMENT_SIZE ImageProperty = C.CL_IMAGE_ELEMENT_SIZE
	IMAGE_ROW_PITCH    ImageProperty = C.CL_IMAGE_ROW_PITCH
	IMAGE_SLICE_PITCH  ImageProperty = C.CL_IMAGE_SLICE_PITCH
	IMAGE_WIDTH        ImageProperty = C.CL_IMAGE_WIDTH
	IMAGE_HEIGHT       ImageProperty = C.CL_IMAGE_HEIGHT
	IMAGE_DEPTH        ImageProperty = C.CL_IMAGE_DEPTH
)

type Kernel

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

func (*Kernel) SetArg

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

func (*Kernel) SetArgs

func (k *Kernel) SetArgs(offset uint, args []interface{}) error

type MemoryFlags

type MemoryFlags C.cl_mem_flags
const (
	MEM_READ_WRITE     MemoryFlags = C.CL_MEM_READ_WRITE
	MEM_WRITE_ONLY     MemoryFlags = C.CL_MEM_WRITE_ONLY
	MEM_READ_ONLY      MemoryFlags = C.CL_MEM_READ_ONLY
	MEM_USE_HOST_PTR   MemoryFlags = C.CL_MEM_USE_HOST_PTR
	MEM_ALLOC_HOST_PTR MemoryFlags = C.CL_MEM_ALLOC_HOST_PTR
	MEM_COPY_HOST_PTR  MemoryFlags = C.CL_MEM_COPY_HOST_PTR
)

type MemoryType

type MemoryType C.cl_mem_object_type
const (
	MEM_OBJECT_BUFFER  MemoryType = C.CL_MEM_OBJECT_BUFFER
	MEM_OBJECT_IMAGE2D MemoryType = C.CL_MEM_OBJECT_IMAGE2D
	MEM_OBJECT_IMAGE3D MemoryType = C.CL_MEM_OBJECT_IMAGE3D
)

type Platform

type Platform struct {
	Devices []Device
	// contains filtered or unexported fields
}

func GetPlatforms

func GetPlatforms() []Platform

func (*Platform) Property

func (p *Platform) Property(prop PlatformProperty) string

type PlatformProperty

type PlatformProperty C.cl_platform_info
const (
	PLATFORM_PROFILE    PlatformProperty = C.CL_PLATFORM_PROFILE
	PLATFORM_VERSION    PlatformProperty = C.CL_PLATFORM_VERSION
	PLATFORM_NAME       PlatformProperty = C.CL_PLATFORM_NAME
	PLATFORM_VENDOR     PlatformProperty = C.CL_PLATFORM_VENDOR
	PLATFORM_EXTENSIONS PlatformProperty = C.CL_PLATFORM_EXTENSIONS
)

type Program

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

func (*Program) Build

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

func (*Program) BuildStatus

func (p *Program) BuildStatus(dev Device) BuildStatus

func (*Program) NewKernelNamed

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

func (*Program) Property

func (p *Program) Property(dev Device, prop BuildProperty) string

type Sampler

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

func (*Sampler) Property

func (s *Sampler) Property(prop SamplerProperty) interface{}

type SamplerProperty

type SamplerProperty C.cl_sampler_info
const (
	SAMPLER_REFERENCE_COUNT SamplerProperty = C.CL_SAMPLER_REFERENCE_COUNT
	//SAMPLER_CONTEXT           SamplerProperty = C.CL_SAMPLER_CONTEXT
	SAMPLER_NORMALIZED_COORDS SamplerProperty = C.CL_SAMPLER_NORMALIZED_COORDS
	SAMPLER_ADDRESSING_MODE   SamplerProperty = C.CL_SAMPLER_ADDRESSING_MODE
	SAMPLER_FILTER_MODE       SamplerProperty = C.CL_SAMPLER_FILTER_MODE
)

type Size

type Size C.size_t

Jump to

Keyboard shortcuts

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