Documentation
¶
Overview ¶
program
Index ¶
- Constants
- Variables
- func Init(version pure.Version, paths ...string) error
- func SetHandle(handle uintptr)
- type BuildOptions
- type Bytes
- type Device
- func (d *Device) AddMultipleProgram(sources []string) (*Program, error)
- func (d *Device) AddMultipleProgramWithBuildingFlags(sources []string, flags string) (*Program, error)
- func (d *Device) AddProgram(source string) (*Program, error)
- func (d *Device) DriverVersion() (string, error)
- func (d *Device) Extensions() (string, error)
- func (d *Device) GetInfoString(param pure.DeviceInfo) (string, error)
- func (d *Device) Kernel(name string) (*Kernel, error)
- func (d *Device) Name() (string, error)
- func (d *Device) NewBytes(size int) (*Bytes, error)
- func (d *Device) NewImage2D(imageType ImageType, bounds image.Rectangle) (*Image, error)
- func (d *Device) NewImageFromImage2D(img image.Image) (*Image, error)
- func (d *Device) NewVector(data interface{}) (*Vector, error)
- func (d *Device) OpenCLCVersion() (string, error)
- func (d *Device) PlatformDriverVersion() (string, error)
- func (d *Device) PlatformExtensions() ([]pure.Extension, error)
- func (d *Device) PlatformName() (string, error)
- func (d *Device) PlatformOpenCLCVersion() (string, error)
- func (d *Device) PlatformProfile() (string, error)
- func (d *Device) PlatformVendor() (string, error)
- func (d *Device) Profile() (string, error)
- func (d *Device) Release() error
- func (d *Device) String() (string, error)
- func (d *Device) Vendor() (string, error)
- func (d *Device) Version() (string, error)
- type ErrUnsupportedArgumentType
- type Event
- type Image
- type ImageType
- type Kernel
- type KernelCall
- type Platform
- type Program
- type Vector
Constants ¶
const ( ImageTypeGray = ImageType(constants.CL_INTENSITY) ImageTypeRGBA = ImageType(constants.CL_RGBA) )
available image types
Variables ¶
var ( //ErrUnknown Generally an unexpected result from an OpenCL function (e.g. CL_SUCCESS but null pointer) ErrUnknown = errors.New("cl: unknown error") )
Functions ¶
Types ¶
type BuildOptions ¶
type BuildOptions struct {
// Preprocessor options
Warnings bool
Macros map[string]string
DirectoryIncludes []string
Version pure.Version
// Math intrinsics options
SinglePrecisionConstant bool
MadEnable bool
NoSignedZeros bool
FastRelaxedMaths bool
UnsafeMaths bool
// Extensions
NvidiaVerbose bool
}
func (*BuildOptions) String ¶
func (op *BuildOptions) String() string
type Bytes ¶
type Bytes struct {
// contains filtered or unexported fields
}
Bytes is a memory buffer on the device that holds []byte
func (*Bytes) Map ¶
Map applies an map kernel on all elements of the buffer It's a non-blocking call, so it can return an event object that you can wait on. The caller is responsible to release the returned event when it's not used anymore.
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
Device the only needed entrence for the BlackCL represents the device on which memory can be allocated and kernels run it abstracts away all the complexity of contexts/platforms/queues
func GetDevices ¶
func GetDevices(deviceType pure.DeviceType) ([]*Device, error)
GetDevices returns all devices of all platforms with specified type
func (*Device) AddMultipleProgram ¶
AddMultipleProgram compiles programs sources, this function is very sensitive to strings coding
func (*Device) AddMultipleProgramWithBuildingFlags ¶
func (d *Device) AddMultipleProgramWithBuildingFlags(sources []string, flags string) (*Program, error)
AddMultipleProgramWithBuildingFlags compiles programs sources with flags, this function is very sensitive to strings coding add flags only when you know what you do
func (*Device) AddProgram ¶
AddProgram compiles program source, this function is very sensitive to strings coding, and more then 3 programs, so I recommend all kernels put in one string
func (*Device) DriverVersion ¶
DriverVersion device info - driver version
func (*Device) Extensions ¶
Extensions device info - extensions
func (*Device) GetInfoString ¶
func (d *Device) GetInfoString(param pure.DeviceInfo) (string, error)
func (*Device) Kernel ¶
Kernel returns an kernel if retrieving the kernel didn't complete the function will panic
func (*Device) NewImage2D ¶
NewImage2D NewImage allocates an image buffer
func (*Device) NewImageFromImage2D ¶
NewImageFromImage2D NewImageFromImage creates new Image and copies data from image.Image
func (*Device) NewVector ¶
NewVector want slice or array to create opencl vector in gpu I highly recommend primitive types such as int, uint, float32, uint8, ..., but you are free to experiment with GO structs, but you must keep in mind, that is there no guarantee how OpenCL will pass them
func (*Device) OpenCLCVersion ¶
OpenCLCVersion device info - OpenCL C Version
func (*Device) PlatformDriverVersion ¶
func (*Device) PlatformName ¶
func (*Device) PlatformOpenCLCVersion ¶
func (*Device) PlatformProfile ¶
func (*Device) PlatformVendor ¶
type ErrUnsupportedArgumentType ¶
type ErrUnsupportedArgumentType struct {
Index int
Value interface{}
}
ErrUnsupportedArgumentType error
func (ErrUnsupportedArgumentType) Error ¶
func (e ErrUnsupportedArgumentType) Error() string
type Image ¶
type Image struct {
// contains filtered or unexported fields
}
Image memory buffer on the device with image data
type Kernel ¶
type Kernel struct {
// contains filtered or unexported fields
}
Kernel represent an single kernel
func (*Kernel) Global ¶
func (k *Kernel) Global(globalWorkSizes ...int) KernelCall
Global returns an KernelCall with global size set
func (*Kernel) GlobalOffset ¶
func (k *Kernel) GlobalOffset(globalWorkOffsets ...int) KernelCall
Global returns an kernel with global offsets set
func (*Kernel) Local ¶
func (k *Kernel) Local(localWorkSizes ...int) KernelCall
Local sets the local work sizes and returns an KernelCall which takes kernel arguments and runs the kernel
func (*Kernel) ReleaseKernel ¶
type KernelCall ¶
type KernelCall struct {
// contains filtered or unexported fields
}
KernelCall is a kernel with global and local work sizes set and it's ready to be run
func (KernelCall) Global ¶
func (kc KernelCall) Global(globalWorkSizes ...int) KernelCall
Global returns an KernelCall with global size set
func (KernelCall) GlobalOffset ¶
func (kc KernelCall) GlobalOffset(globalWorkOffsets ...int) KernelCall
Global returns an kernel with global offsets set
func (KernelCall) Local ¶
func (kc KernelCall) Local(localWorkSizes ...int) KernelCall
Local sets the local work sizes and returns an KernelCall which takes kernel arguments and runs the kernel
func (KernelCall) Run ¶
func (kc KernelCall) Run(waitEvents []*Event, args ...interface{}) (event *Event, err error)
Run calls the kernel on its device with specified global and local work sizes and arguments It's a non-blocking call, so it can return an event object that you can wait on. The caller is responsible to release the returned event when it's not used anymore.
type Platform ¶
type Platform struct {
// contains filtered or unexported fields
}
func (*Platform) GetProfile ¶
func (*Platform) GetVersion ¶
type Program ¶
type Program struct {
// contains filtered or unexported fields
}
func (*Program) GetBinaries ¶
GetBinaries Return the program binaries associated with program.
type Vector ¶
type Vector struct {
// contains filtered or unexported fields
}
Vector is a memory buffer on device that holds []float32
func (*Vector) Data ¶
Data gets data *reflect.Value in from device, it's a blocking call use v, err := Data(); elen := any(retrievedData.Index(i).Float()) ...
func (*Vector) DataArray ¶
DataArray gets data *reflect.Value in from device, it's a blocking call use v, err := DataArray(); array := *(v.Interface().(*[16]float32))
func (*Vector) Map ¶
Map applies an map kernel on all elements of the vector It's a non-blocking call, so it can return an event object that you can wait on. The caller is responsible to release the returned event when it's not used anymore.







