gpu

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2018 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupportedPlatform = errors.New("the platform is not currently supported to expose GPU devices")
)
View Source
var Nvidias = []uint64{
	4318,
}
View Source
var Radeons = []uint64{
	4098,

	16915456,
}

Functions

func Marshal

func Marshal(d Device) *sonm.GPUDevice

func MarshalDevices

func MarshalDevices(d []Device) []*sonm.GPUDevice

func WithOpenClDeviceVersion

func WithOpenClDeviceVersion(version string) func(*sonm.GPUDevice) error

WithOpenClDeviceVersion option sets OpenCL version.

The format must be: `OpenCL <major.minor> <vendor-specific information>`.

func WithOpenClDeviceVersionSpec

func WithOpenClDeviceVersionSpec(major, minor int32) func(*sonm.GPUDevice) error

func WithVendorId

func WithVendorId(id uint) func(*sonm.GPUDevice) error

Types

type Device

type Device interface {
	// Name returns GPU model name.
	Name() string
	// VendorId returns an unique device vendor identifier. An example of a
	// unique device identifier could be the PCIe ID.
	VendorId() uint
	// VendorName returns GPU vendor name.
	VendorName() string
	// VendorType returns GPU vendor type. could be nvidia, radeon or none
	VendorType() sonm.GPUVendorType
	// MaxMemorySize returns the total maximum memory size the device can hold
	// in bytes.
	MaxMemorySize() uint64
	// MaxClockFrequency returns maximum configured clock frequency of the
	// device in MHz.
	MaxClockFrequency() uint
	// OpenCLDeviceVersionMajor returns the OpenCL major version supported by the
	// device.
	OpenCLDeviceVersionMajor() int
	// OpenCLDeviceVersionMinor returns the OpenCL minor version supported by the
	// device.
	OpenCLDeviceVersionMinor() int

	Hash() []byte
}

Device describes a GPU device.

func GetGPUDevices

func GetGPUDevices() ([]Device, error)

GetGPUDevices returns a list of available GPU devices on the machine.

func GetGPUDevicesUsingOpenCL

func GetGPUDevicesUsingOpenCL() ([]Device, error)

func NewDevice

func NewDevice(name, vendorName string, maxClockFrequency, maxMemorySize uint64, options ...Option) (Device, error)

func Unmarshal

func Unmarshal(proto *sonm.GPUDevice) (Device, error)

func UnmarshalDevices

func UnmarshalDevices(d []*sonm.GPUDevice) ([]Device, error)

type Option

type Option func(*sonm.GPUDevice) error

type Version

type Version struct {
	Major int
	Minor int
}

Jump to

Keyboard shortcuts

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