Documentation
¶
Overview ¶
Package scl is a set of bindings to make it easy to execute OpenCL kernels. It is inspired by the SimpleOpenCL C library by Oscar Amoros.
References:
http://github.com/go-gl/cl http://code.google.com/p/simple-opencl/ http://www.khronos.org/opencl/
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
func Run(h *Hardware, s *Software, workSizeX, workSizeY int, format string, args ...interface{}) error
The Run function launches a kernel with the given argument list. The format string has a printf style list describing the type of each argument:
%r read only buffer: size in bytes + slice of values %w write only buffer: size in bytes + slice of values %R read and write buffer: size in bytes + slice of values %a pass by value argument: size in bytes + pointer to value %b buffer object: pointer to a scl.Buffer only %N null argument for local memory: size in bytes only
Types ¶
type Buffer ¶
Buffer type encapsulates a cl_mem structure to pass data between host and device
func NewBuffer ¶
NewBuffer allocates a new buffer with given mode and size in bytes. data may be nil in the case where we do not need to access the buffer from the host.
type Device ¶
type Device struct { Platform cl.PlatformID DeviceId cl.DeviceId Units int Memory uint64 Type cl.DeviceType Name string }
Device has information about the OpenCL platform and device.
type DeviceList ¶
type DeviceList []*Device
DeviceList is a list of devices
func Devices ¶
func Devices() DeviceList
Devices function returns a list with all available devices.
func (DeviceList) Select ¶
func (devs DeviceList) Select(devType cl.DeviceType) (h *Hardware)
Select method returns the "best" hardware of given type from list of devices.
type Hardware ¶
type Hardware struct { *Device Context cl.Context Queue cl.CommandQueue }
Hardware is a struct with an OpenCL device and associated context and queue.
type Software ¶
Software is a struct encapulating program and kernel data.
func Compile ¶
Compile function compiles a kernel from source string and creates a new software object.
func CompileFile ¶
CompileFile function compiles a kernel from source file and creates a new software object.
func (*Software) EnqueueKernel ¶
Enqueue kernel method runs an NDRange kernel
func (*Software) Release ¶
func (s *Software) Release()
Release method frees any resources tied to the software object.