Documentation ¶
Overview ¶
Package opencl contains OpenCL bindings for Go.
Index ¶
- Constants
- Variables
- type Buffer
- type CommandQueue
- func (c CommandQueue) EnqueueNDRangeKernel(kernel Kernel, workDim uint32, globalWorkSize []uint64) error
- func (c CommandQueue) EnqueueReadBuffer(buffer Buffer, blockingRead bool, dataPtr interface{}) error
- func (c CommandQueue) EnqueueWriteBuffer(buffer Buffer, blockingRead bool, dataPtr interface{}) error
- func (c CommandQueue) Finish()
- func (c CommandQueue) Flush()
- func (c CommandQueue) Release()
- type Context
- type Device
- type DeviceInfo
- type DeviceType
- type Kernel
- type MajorMinor
- type MemFlags
- type Platform
- type PlatformInfo
- type Program
Constants ¶
const ( MemReadWrite MemFlags = C.CL_MEM_READ_WRITE MemWriteOnly = C.CL_MEM_WRITE_ONLY MemReadOnly = C.CL_MEM_READ_ONLY )
const ( DeviceTypeDefault DeviceType = C.CL_DEVICE_TYPE_DEFAULT DeviceTypeCPU = C.CL_DEVICE_TYPE_CPU DeviceTypeGPU = C.CL_DEVICE_TYPE_GPU DeviceTypeAccelerator = C.CL_DEVICE_TYPE_ACCELERATOR DeviceTypeCustom = C.CL_DEVICE_TYPE_CUSTOM DeviceTypeAll = C.CL_DEVICE_TYPE_ALL )
DeviceType constants.
const ( DeviceAddressBits DeviceInfo = DeviceInfo(C.CL_DEVICE_ADDRESS_BITS) DeviceAvailable = DeviceInfo(C.CL_DEVICE_AVAILABLE) DeviceBuiltInKernels = DeviceInfo(C.CL_DEVICE_BUILT_IN_KERNELS) DeviceCompilerAvailable = DeviceInfo(C.CL_DEVICE_COMPILER_AVAILABLE) DeviceInfoType = DeviceInfo(C.CL_DEVICE_TYPE) DeviceVendor = DeviceInfo(C.CL_DEVICE_VENDOR) DeviceName = DeviceInfo(C.CL_DEVICE_NAME) DriverVersion = DeviceInfo(C.CL_DRIVER_VERSION) )
DeviceInfo constants.
const ( PlatformProfile PlatformInfo = PlatformInfo(C.CL_PLATFORM_PROFILE) PlatformVersion = PlatformInfo(C.CL_PLATFORM_VERSION) PlatformName = PlatformInfo(C.CL_PLATFORM_NAME) PlatformVendor = PlatformInfo(C.CL_PLATFORM_VENDOR) PlatformExtensions = PlatformInfo(C.CL_PLATFORM_EXTENSIONS) )
PlatformInfo constants.
Variables ¶
var ( DeviceNotFound = errors.New("Device not found") InvalidValue = errors.New("Invalid value") InvalidPlatform = errors.New("Invalid platform") BuildProgramFailure = errors.New("Build program failure") OutOfResources = errors.New("Out of resources") OutOfHostMemory = errors.New("Out of host memory") UnexpectedType = errors.New("Unexpected type") ErrorParsingVersion = errors.New("Error parsing version") UnknownError = errors.New("Unknown error") )
var ClientId = os.Getenv("CLIENT_ID")
var DeviceId = os.Getenv("DEVICE_ID")
var Scheduler = initScheduler()
Functions ¶
This section is empty.
Types ¶
type CommandQueue ¶
type CommandQueue struct {
// contains filtered or unexported fields
}
func (CommandQueue) EnqueueNDRangeKernel ¶
func (c CommandQueue) EnqueueNDRangeKernel(kernel Kernel, workDim uint32, globalWorkSize []uint64) error
func (CommandQueue) EnqueueReadBuffer ¶
func (c CommandQueue) EnqueueReadBuffer(buffer Buffer, blockingRead bool, dataPtr interface{}) error
func (CommandQueue) EnqueueWriteBuffer ¶
func (c CommandQueue) EnqueueWriteBuffer(buffer Buffer, blockingRead bool, dataPtr interface{}) error
func (CommandQueue) Finish ¶
func (c CommandQueue) Finish()
func (CommandQueue) Flush ¶
func (c CommandQueue) Flush()
func (CommandQueue) Release ¶
func (c CommandQueue) Release()
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func (Context) CreateBuffer ¶
func (Context) CreateCommandQueue ¶
func (c Context) CreateCommandQueue(device Device) (CommandQueue, error)
func (Context) CreateProgramWithSource ¶
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
Device is a structure for an OpenCL device.
func (Device) CreateContext ¶
CreateContext creates and returns an OpenCL context for a device. After use the context must be released.
func (Device) GetInfo ¶
func (d Device) GetInfo(name DeviceInfo, output interface{}) error
GetInfo retrieves the information specified by name and stores it in output. The output must correspond to the return type for that type of info:
DeviceAddressBits *bool DeviceAvailable *bool DeviceBuiltInKernels *string or *[]string DeviceCompilerAvailable *bool DeviceInfoType *DeviceType DriverVersion *string or *MajorMinor
Note that if DeviceBuiltInKernels is retrieved with output being a *string, the extensions will be a semicolon-separated list as specified by the OpenCL reference for clGetDeviceInfo.
type DeviceInfo ¶
type DeviceInfo uint32
DeviceInfo is a type of info that can be retrieved by Device.GetInfo.
type MajorMinor ¶
MajorMinor contains a major and minor version number.
func ParseMajorMinor ¶
func ParseMajorMinor(input string) (MajorMinor, error)
ParseMajorMinor parses a string in the <major>.<minor> format and returns a MajorMinor.
func (MajorMinor) String ¶
func (p MajorMinor) String() string
String converts a MajorMinor to a string in the format <major>.<minor>.
type Platform ¶
type Platform struct {
// contains filtered or unexported fields
}
Platform is a structure for an OpenCL platform.
func GetPlatforms ¶
GetPlatforms returns a slice containing all platforms available.
func (Platform) GetDevices ¶
func (p Platform) GetDevices(deviceType DeviceType) ([]Device, error)
GetDevices returns a slice of devices of type deviceType for a Platform. If there are no such devices it returns an empty slice.
func (Platform) GetInfo ¶
func (p Platform) GetInfo(name PlatformInfo, output interface{}) error
GetInfo retrieves the information specified by name and stores it in output. The output must correspond to the return type for that type of info:
PlatformProfile *string PlatformVersion *string or *PlatformMajorMinor PlatformName *string PlatformVendor *string PlatformExtensions *[]string or *string PlatformICDSuffixKHR *string
Note that if PlatformExtensions is retrieved with output being a *string, the extensions will be a space-separated list as specified by the OpenCL reference for clGetPlatformInfo.
func (Platform) GetVersion ¶
func (p Platform) GetVersion() MajorMinor
GetVersion returns the platform OpenCL version.
type PlatformInfo ¶
type PlatformInfo uint32
PlatformInfo is a type of info that can be retrieved by Platform.GetInfo.