opencl

package
v0.0.0-...-bd43069 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2020 License: MIT Imports: 5 Imported by: 0

README

opencl

This is based off go-opencl with the following changes:

  • Lots of code removed to support only what this project needs
  • Removed call to panic whenever a function that should never fail, fails. It should be left up to the end user to decide what to do
  • Changed how string allocation's occur in the getInfoString methods
  • OS X Support

Why?

Hashcat includes code to list OpenCL devices but requires one to fully initialize a hashcat context & session to safely pull the device listing back.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDeviceNotFound                     = errors.New("cl: Device Not Found")
	ErrDeviceNotAvailable                 = errors.New("cl: Device Not Available")
	ErrCompilerNotAvailable               = errors.New("cl: Compiler Not Available")
	ErrMemObjectAllocationFailure         = errors.New("cl: Mem Object Allocation Failure")
	ErrOutOfResources                     = errors.New("cl: Out Of Resources")
	ErrOutOfHostMemory                    = errors.New("cl: Out Of Host Memory")
	ErrProfilingInfoNotAvailable          = errors.New("cl: Profiling Info Not Available")
	ErrMemCopyOverlap                     = errors.New("cl: Mem Copy Overlap")
	ErrImageFormatMismatch                = errors.New("cl: Image Format Mismatch")
	ErrImageFormatNotSupported            = errors.New("cl: Image Format Not Supported")
	ErrBuildProgramFailure                = errors.New("cl: Build Program Failure")
	ErrMapFailure                         = errors.New("cl: Map Failure")
	ErrMisalignedSubBufferOffset          = errors.New("cl: Misaligned Sub Buffer Offset")
	ErrExecStatusErrorForEventsInWaitList = errors.New("cl: Exec Status Error For Events In Wait List")
	ErrCompileProgramFailure              = errors.New("cl: Compile Program Failure")
	ErrLinkerNotAvailable                 = errors.New("cl: Linker Not Available")
	ErrLinkProgramFailure                 = errors.New("cl: Link Program Failure")
	ErrDevicePartitionFailed              = errors.New("cl: Device Partition Failed")
	ErrKernelArgInfoNotAvailable          = errors.New("cl: Kernel Arg Info Not Available")
	ErrInvalidValue                       = errors.New("cl: Invalid Value")
	ErrInvalidDeviceType                  = errors.New("cl: Invalid Device Type")
	ErrInvalidPlatform                    = errors.New("cl: Invalid Platform")
	ErrInvalidDevice                      = errors.New("cl: Invalid Device")
	ErrInvalidContext                     = errors.New("cl: Invalid Context")
	ErrInvalidQueueProperties             = errors.New("cl: Invalid Queue Properties")
	ErrInvalidCommandQueue                = errors.New("cl: Invalid Command Queue")
	ErrInvalidHostPtr                     = errors.New("cl: Invalid Host Ptr")
	ErrInvalidMemObject                   = errors.New("cl: Invalid Mem Object")
	ErrInvalidImageFormatDescriptor       = errors.New("cl: Invalid Image Format Descriptor")
	ErrInvalidImageSize                   = errors.New("cl: Invalid Image Size")
	ErrInvalidSampler                     = errors.New("cl: Invalid Sampler")
	ErrInvalidBinary                      = errors.New("cl: Invalid Binary")
	ErrInvalidBuildOptions                = errors.New("cl: Invalid Build Options")
	ErrInvalidProgram                     = errors.New("cl: Invalid Program")
	ErrInvalidProgramExecutable           = errors.New("cl: Invalid Program Executable")
	ErrInvalidKernelName                  = errors.New("cl: Invalid Kernel Name")
	ErrInvalidKernelDefinition            = errors.New("cl: Invalid Kernel Definition")
	ErrInvalidKernel                      = errors.New("cl: Invalid Kernel")
	ErrInvalidArgIndex                    = errors.New("cl: Invalid Arg Index")
	ErrInvalidArgValue                    = errors.New("cl: Invalid Arg Value")
	ErrInvalidArgSize                     = errors.New("cl: Invalid Arg Size")
	ErrInvalidKernelArgs                  = errors.New("cl: Invalid Kernel Args")
	ErrInvalidWorkDimension               = errors.New("cl: Invalid Work Dimension")
	ErrInvalidWorkGroupSize               = errors.New("cl: Invalid Work Group Size")
	ErrInvalidWorkItemSize                = errors.New("cl: Invalid Work Item Size")
	ErrInvalidGlobalOffset                = errors.New("cl: Invalid Global Offset")
	ErrInvalidEventWaitList               = errors.New("cl: Invalid Event Wait List")
	ErrInvalidEvent                       = errors.New("cl: Invalid Event")
	ErrInvalidOperation                   = errors.New("cl: Invalid Operation")
	ErrInvalidGlObject                    = errors.New("cl: Invalid Gl Object")
	ErrInvalidBufferSize                  = errors.New("cl: Invalid Buffer Size")
	ErrInvalidMipLevel                    = errors.New("cl: Invalid Mip Level")
	ErrInvalidGlobalWorkSize              = errors.New("cl: Invalid Global Work Size")
	ErrInvalidProperty                    = errors.New("cl: Invalid Property")
	ErrInvalidImageDescriptor             = errors.New("cl: Invalid Image Descriptor")
	ErrInvalidCompilerOptions             = errors.New("cl: Invalid Compiler Options")
	ErrInvalidLinkerOptions               = errors.New("cl: Invalid Linker Options")
	ErrInvalidDevicePartitionCount        = errors.New("cl: Invalid Device Partition Count")
	ErrNoValidICDs                        = errors.New("cl: No valid ICDs found")
)
View Source
var ErrUnknown = errors.New("cl: unknown error")

ErrUnknown is a result from an OpenCL function (e.g. CL_SUCCESS but null pointer)

Functions

This section is empty.

Types

type Device

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

func GetDevices

func GetDevices(platform *Platform, deviceType DeviceType) ([]*Device, error)

GetDevices returns a list of available devices on a platform. 'platform' refers to the platform returned by GetPlatforms or can be nil. If platform is nil, the behavior is implementation-defined.

func (*Device) DriverVersion

func (s *Device) DriverVersion() (string, error)

DriverVersion returns the OpenCL driver revision

func (*Device) Name

func (s *Device) Name() (string, error)

Name returns the name of the OpenCL device

func (*Device) OpenCLVersion

func (s *Device) OpenCLVersion() (string, error)

OpenCLVersion returns the version of OpenCL supported by this device

func (*Device) Type

func (s *Device) Type() (dt DeviceType, err error)

Type returns the type of OpenCL device this is (CPU, GPU, etc.)

type DeviceType

type DeviceType uint32

DeviceType is the type of OpenCL Device (e.g. FPGA, CPU, GPU)

const (
	DeviceTypeCPU         DeviceType = C.CL_DEVICE_TYPE_CPU
	DeviceTypeGPU         DeviceType = C.CL_DEVICE_TYPE_GPU
	DeviceTypeAccelerator DeviceType = C.CL_DEVICE_TYPE_ACCELERATOR
	DeviceTypeDefault     DeviceType = C.CL_DEVICE_TYPE_DEFAULT
	DeviceTypeAll         DeviceType = C.CL_DEVICE_TYPE_ALL
)

func (DeviceType) String

func (dt DeviceType) String() string

type ErrOther

type ErrOther int

func (ErrOther) Error

func (e ErrOther) Error() string

type Platform

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

func GetPlatforms

func GetPlatforms() ([]*Platform, error)

GetPlatforms returns a list of available OpenCL platforms

func (*Platform) GetDevices

func (p *Platform) GetDevices(deviceType DeviceType) ([]*Device, error)

GetDevices returns a list of devices for this particular platform

func (*Platform) Name

func (p *Platform) Name() (string, error)

Name returns the name of the OpenCL platform

func (*Platform) Profile

func (p *Platform) Profile() (string, error)

Profile returns the profile for this OpenCL platform

func (*Platform) Vendor

func (p *Platform) Vendor() (string, error)

Vendor returns the name of the vendor for this OpenCL platform

func (*Platform) Version

func (p *Platform) Version() (string, error)

Version returns the max OpenCL version for this platform

Jump to

Keyboard shortcuts

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