gorgonia: gorgonia.org/gorgonia/cuda Index | Files

package cuda

import "gorgonia.org/gorgonia/cuda"

Index

Package Files

arena.go arith.go bfc.go builtin.go cmp.go engine.go errors.go extension.go external.go interfaces.go linalg.go release.go utils.go

type Arena Uses

type Arena interface {
    // Get returns a NoOpError when it cannot get a memory. Please allocate
    Get(size int64) (tensor.Memory, error)

    // Puts the memory back into arena
    Put(mem tensor.Memory, size int64)

    // ResetAllocator resets the allocator statisttics, but doesn't actually deallocate  real memory
    ResetAllocator()
}

Arena is a representation of a memory arena which is managed.

type Engine Uses

type Engine struct {
    tensor.Engine
    sync.Mutex
    // contains filtered or unexported fields
}

func (*Engine) Accessible Uses

func (e *Engine) Accessible(mem tensor.Memory) (tensor.Memory, error)

func (*Engine) Add Uses

func (e *Engine) Add(a tensor.Tensor, b tensor.Tensor, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)

Add implements tensor.Adder. It does not support safe or increment operation options and will return an error if those options are passed in

func (*Engine) AddScalar Uses

func (e *Engine) AddScalar(a tensor.Tensor, b interface{}, leftTensor bool, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)

AddScalar implements tensor.Adder. It does not support safe or increment operation options and will return an error if those options are passed in

func (*Engine) Alloc Uses

func (e *Engine) Alloc(size int64) (tensor.Memory, error)

func (*Engine) AllocAccessible Uses

func (e *Engine) AllocAccessible() bool

func (*Engine) AllocFlags Uses

func (e *Engine) AllocFlags() (tensor.MemoryFlag, tensor.DataOrder)

func (*Engine) BLASContext Uses

func (e *Engine) BLASContext() *cublas.Standard

func (*Engine) CUDNNContext Uses

func (e *Engine) CUDNNContext() *cudnn.Context

func (*Engine) Close Uses

func (e *Engine) Close() error

func (*Engine) Context Uses

func (e *Engine) Context() *cu.BatchedContext

func (*Engine) Div Uses

func (e *Engine) Div(a tensor.Tensor, b tensor.Tensor, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)

Div implements tensor.Diver. It does not support safe or increment operation options and will return an error if those options are passed in

func (*Engine) DivScalar Uses

func (e *Engine) DivScalar(a tensor.Tensor, b interface{}, leftTensor bool, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)

DivScalar implements tensor.Diver. It does not support safe or increment operation options and will return an error if those options are passed in

func (*Engine) DoWork Uses

func (e *Engine) DoWork() error

func (*Engine) ElEq Uses

func (e *Engine) ElEq(a tensor.Tensor, b tensor.Tensor, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)

ElEq implements tensor.ElEqer. It does not support safe or increment operation options and will return an error if those options are passed in

func (*Engine) ElNe Uses

func (e *Engine) ElNe(a tensor.Tensor, b tensor.Tensor, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)

ElNe implements tensor.ElNeer. It does not support safe or increment operation options and will return an error if those options are passed in

func (*Engine) ElemGridSize Uses

func (e *Engine) ElemGridSize(n int) (gridDimX, gridDimY, gridDimZ, blockDimX, blockDimY, blockDimZ int)

elemGridSize calculates the gridsize for elementwise operations. n is the number of elements

func (*Engine) EqScalar Uses

func (e *Engine) EqScalar(a tensor.Tensor, b interface{}, leftTensor bool, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)

EqScalar implements tensor.ElEqer. It does not support safe or increment operation options and will return an error if those options are passed in

func (*Engine) Errors Uses

func (e *Engine) Errors() error

func (*Engine) Free Uses

func (e *Engine) Free(mem tensor.Memory, size int64) error

func (*Engine) Functions Uses

func (e *Engine) Functions() map[string]cu.Function

func (*Engine) Get Uses

func (e *Engine) Get(size int64) (tensor.Memory, error)

func (*Engine) Gt Uses

func (e *Engine) Gt(a tensor.Tensor, b tensor.Tensor, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)

Gt implements tensor.Gter. It does not support safe or increment operation options and will return an error if those options are passed in

func (*Engine) GtScalar Uses

func (e *Engine) GtScalar(a tensor.Tensor, b interface{}, leftTensor bool, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)

GtScalar implements tensor.Gter. It does not support safe or increment operation options and will return an error if those options are passed in

func (*Engine) Gte Uses

func (e *Engine) Gte(a tensor.Tensor, b tensor.Tensor, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)

Gte implements tensor.Gteer. It does not support safe or increment operation options and will return an error if those options are passed in

func (*Engine) GteScalar Uses

func (e *Engine) GteScalar(a tensor.Tensor, b interface{}, leftTensor bool, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)

GteScalar implements tensor.Gteer. It does not support safe or increment operation options and will return an error if those options are passed in

func (*Engine) HasFunc Uses

func (e *Engine) HasFunc(name string) bool

HasFunc returns true if the execution is external (cgo/cuda/openCL) AND the external device contains the function with the given name

func (*Engine) HasInf Uses

func (e *Engine) HasInf(a tensor.Tensor) (bool, error)

func (*Engine) HasNaN Uses

func (e *Engine) HasNaN(a tensor.Tensor) (bool, error)

func (*Engine) Init Uses

func (e *Engine) Init(device cu.Device, size int64) (err error)

Init creates a CUDA engine with the given size for the given device

func (*Engine) LoadCUDAFunc Uses

func (e *Engine) LoadCUDAFunc(moduleName, data string, funcs []string) (err error)

LoadCUDAFunc loads a string representing a CUDA PTX file into the engine, giving it the universe of computing functions.

func (*Engine) Lt Uses

func (e *Engine) Lt(a tensor.Tensor, b tensor.Tensor, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)

Lt implements tensor.Lter. It does not support safe or increment operation options and will return an error if those options are passed in

func (*Engine) LtScalar Uses

func (e *Engine) LtScalar(a tensor.Tensor, b interface{}, leftTensor bool, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)

LtScalar implements tensor.Lter. It does not support safe or increment operation options and will return an error if those options are passed in

func (*Engine) Lte Uses

func (e *Engine) Lte(a tensor.Tensor, b tensor.Tensor, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)

Lte implements tensor.Lteer. It does not support safe or increment operation options and will return an error if those options are passed in

func (*Engine) LteScalar Uses

func (e *Engine) LteScalar(a tensor.Tensor, b interface{}, leftTensor bool, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)

LteScalar implements tensor.Lteer. It does not support safe or increment operation options and will return an error if those options are passed in

func (*Engine) MatMul Uses

func (e *Engine) MatMul(a, b, prealloc tensor.Tensor) (err error)

func (*Engine) MatVecMul Uses

func (e *Engine) MatVecMul(a, b, prealloc tensor.Tensor) (err error)

func (*Engine) Memclr Uses

func (e *Engine) Memclr(mem tensor.Memory)

func (*Engine) Memcpy Uses

func (e *Engine) Memcpy(dst tensor.Memory, src tensor.Memory) error

Memcpy is part of the implementation of tensor.Engine. It is eager, and will signal the context to actually do work. The memory that will be copied is up to the smallest of sizes between dst and src. i.e. if dst is 8 bytes and src is 16 bytes, only the first 8 bytes of src will be copied. Likewise, if dst is 20 bytes and src is 3 bytes, only 3 bytes will be copied.

func (*Engine) Memset Uses

func (e *Engine) Memset(mem tensor.Memory, val interface{}) error

func (*Engine) Mod Uses

func (e *Engine) Mod(a tensor.Tensor, b tensor.Tensor, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)

Mod implements tensor.Moder. It does not support safe or increment operation options and will return an error if those options are passed in

func (*Engine) ModScalar Uses

func (e *Engine) ModScalar(a tensor.Tensor, b interface{}, leftTensor bool, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)

ModScalar implements tensor.Moder. It does not support safe or increment operation options and will return an error if those options are passed in

func (*Engine) Modules Uses

func (e *Engine) Modules() map[string]cu.Module

func (*Engine) Mul Uses

func (e *Engine) Mul(a tensor.Tensor, b tensor.Tensor, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)

Mul implements tensor.Muler. It does not support safe or increment operation options and will return an error if those options are passed in

func (*Engine) MulScalar Uses

func (e *Engine) MulScalar(a tensor.Tensor, b interface{}, leftTensor bool, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)

MulScalar implements tensor.Muler. It does not support safe or increment operation options and will return an error if those options are passed in

func (*Engine) NeScalar Uses

func (e *Engine) NeScalar(a tensor.Tensor, b interface{}, leftTensor bool, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)

NeScalar implements tensor.ElNeer. It does not support safe or increment operation options and will return an error if those options are passed in

func (*Engine) NonStdAlloc Uses

func (e *Engine) NonStdAlloc()

func (*Engine) Outer Uses

func (e *Engine) Outer(a, b, prealloc tensor.Tensor) (err error)

func (*Engine) Pow Uses

func (e *Engine) Pow(a tensor.Tensor, b tensor.Tensor, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)

Pow implements tensor.Power. It does not support safe or increment operation options and will return an error if those options are passed in

func (*Engine) PowScalar Uses

func (e *Engine) PowScalar(a tensor.Tensor, b interface{}, leftTensor bool, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)

PowScalar implements tensor.Power. It does not support safe or increment operation options and will return an error if those options are passed in

func (*Engine) Put Uses

func (e *Engine) Put(mem tensor.Memory, size int64)

func (*Engine) ResetAllocator Uses

func (e *Engine) ResetAllocator()

func (*Engine) Run Uses

func (e *Engine) Run()

func (*Engine) Signal Uses

func (e *Engine) Signal()

func (*Engine) Sub Uses

func (e *Engine) Sub(a tensor.Tensor, b tensor.Tensor, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)

Sub implements tensor.Suber. It does not support safe or increment operation options and will return an error if those options are passed in

func (*Engine) SubScalar Uses

func (e *Engine) SubScalar(a tensor.Tensor, b interface{}, leftTensor bool, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)

SubScalar implements tensor.Suber. It does not support safe or increment operation options and will return an error if those options are passed in

func (*Engine) Sync Uses

func (e *Engine) Sync() chan struct{}

func (*Engine) WorksWith Uses

func (e *Engine) WorksWith(order tensor.DataOrder) bool

type External Uses

type External interface {
    // Arena implies that the machine has to be able to manage its own memory
    Arena

    // Engine implies that the machine is able to allocate and free memory
    tensor.Engine

    // HasFunc checks if a function exists within this machine
    HasFunc(string) bool

    // Sync returns a channel of sync signals
    Sync() chan struct{}

    // Signal signals the machine to do work
    Signal()

    // Context returns the Context (the default implementation returns a *cu.BatchedContext)
    Context() *cu.BatchedContext

    // CUDNNContext returns the cuDNN context
    CUDNNContext() *cudnn.Context

    // BLASContext returns the cuBLAS context
    BLASContext() *cublas.Standard

    // Modules returns the loaded modules. It is indexed by name
    Modules() map[string]cu.Module

    // Functions returns the loaded functions. It is indexed by name
    Functions() map[string]cu.Function

    // ElemGridSize calculates the grid sizes for elementwise operations
    ElemGridSize(n int) (gridDimX, gridDimY, gridDimZ, blockDimX, blockDimY, blockDimZ int)

    // Init initializes the machine
    Init(device cu.Device, size int64) error

    // Close cleans up the machine, and closes all available resources
    Close() error

    // DoWork sends a signal to the batched CUDA Context to actually do work
    DoWork() error
}

External is a representation of an external device, conceptually modelled as a machine

Package cuda imports 14 packages (graph). Updated 2019-04-01. Refresh now. Tools for package owners.