Documentation ¶
Index ¶
- type Arena
- type Engine
- func (e *Engine) Accessible(mem tensor.Memory) (tensor.Memory, error)
- func (e *Engine) Add(a tensor.Tensor, b tensor.Tensor, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)
- func (e *Engine) AddScalar(a tensor.Tensor, b interface{}, leftTensor bool, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)
- func (e *Engine) Alloc(size int64) (tensor.Memory, error)
- func (e *Engine) AllocAccessible() bool
- func (e *Engine) AllocFlags() (tensor.MemoryFlag, tensor.DataOrder)
- func (e *Engine) BLASContext() *cublas.Standard
- func (e *Engine) CUDNNContext() *cudnn.Context
- func (e *Engine) Close() error
- func (e *Engine) Context() *cu.BatchedContext
- func (e *Engine) Div(a tensor.Tensor, b tensor.Tensor, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)
- func (e *Engine) DivScalar(a tensor.Tensor, b interface{}, leftTensor bool, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)
- func (e *Engine) DoWork() error
- func (e *Engine) ElEq(a tensor.Tensor, b tensor.Tensor, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)
- func (e *Engine) ElNe(a tensor.Tensor, b tensor.Tensor, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)
- func (e *Engine) ElemGridSize(n int) (gridDimX, gridDimY, gridDimZ, blockDimX, blockDimY, blockDimZ int)
- func (e *Engine) EqScalar(a tensor.Tensor, b interface{}, leftTensor bool, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)
- func (e *Engine) Errors() error
- func (e *Engine) Free(mem tensor.Memory, size int64) error
- func (e *Engine) Functions() map[string]cu.Function
- func (e *Engine) Get(size int64) (tensor.Memory, error)
- func (e *Engine) Gt(a tensor.Tensor, b tensor.Tensor, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)
- func (e *Engine) GtScalar(a tensor.Tensor, b interface{}, leftTensor bool, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)
- func (e *Engine) Gte(a tensor.Tensor, b tensor.Tensor, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)
- func (e *Engine) GteScalar(a tensor.Tensor, b interface{}, leftTensor bool, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)
- func (e *Engine) HasFunc(name string) bool
- func (e *Engine) HasInf(a tensor.Tensor) (bool, error)
- func (e *Engine) HasNaN(a tensor.Tensor) (bool, error)
- func (e *Engine) Init(device cu.Device, size int64) (err error)
- func (e *Engine) LoadCUDAFunc(moduleName, data string, funcs []string) (err error)
- func (e *Engine) Lt(a tensor.Tensor, b tensor.Tensor, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)
- func (e *Engine) LtScalar(a tensor.Tensor, b interface{}, leftTensor bool, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)
- func (e *Engine) Lte(a tensor.Tensor, b tensor.Tensor, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)
- func (e *Engine) LteScalar(a tensor.Tensor, b interface{}, leftTensor bool, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)
- func (e *Engine) MatMul(a, b, prealloc tensor.Tensor) (err error)
- func (e *Engine) MatVecMul(a, b, prealloc tensor.Tensor) (err error)
- func (e *Engine) Memclr(mem tensor.Memory)
- func (e *Engine) Memcpy(dst tensor.Memory, src tensor.Memory) error
- func (e *Engine) Memset(mem tensor.Memory, val interface{}) error
- func (e *Engine) Mod(a tensor.Tensor, b tensor.Tensor, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)
- func (e *Engine) ModScalar(a tensor.Tensor, b interface{}, leftTensor bool, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)
- func (e *Engine) Modules() map[string]cu.Module
- func (e *Engine) Mul(a tensor.Tensor, b tensor.Tensor, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)
- func (e *Engine) MulScalar(a tensor.Tensor, b interface{}, leftTensor bool, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)
- func (e *Engine) NeScalar(a tensor.Tensor, b interface{}, leftTensor bool, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)
- func (e *Engine) NonStdAlloc()
- func (e *Engine) Outer(a, b, prealloc tensor.Tensor) (err error)
- func (e *Engine) Pow(a tensor.Tensor, b tensor.Tensor, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)
- func (e *Engine) PowScalar(a tensor.Tensor, b interface{}, leftTensor bool, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)
- func (e *Engine) Put(mem tensor.Memory, size int64)
- func (e *Engine) ResetAllocator()
- func (e *Engine) Run()
- func (e *Engine) Signal()
- func (e *Engine) Sub(a tensor.Tensor, b tensor.Tensor, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)
- func (e *Engine) SubScalar(a tensor.Tensor, b interface{}, leftTensor bool, opts ...tensor.FuncOpt) (retVal tensor.Tensor, err error)
- func (e *Engine) Sync() chan struct{}
- func (e *Engine) WorksWith(order tensor.DataOrder) bool
- type External
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Arena ¶
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 ¶
Engine is a CUDA engine
func (*Engine) Add ¶
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 ¶
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) AllocAccessible ¶
AllocAccessible returns true because the engine return Go-accessible memory pointers
func (*Engine) AllocFlags ¶
func (e *Engine) AllocFlags() (tensor.MemoryFlag, tensor.DataOrder)
AllocFlags returns allocation flags
func (*Engine) BLASContext ¶
func (e *Engine) BLASContext() *cublas.Standard
BLASContext returns the cuBLAS context
func (*Engine) CUDNNContext ¶
func (e *Engine) CUDNNContext() *cudnn.Context
CUDNNContext returns the cuDNN context
func (*Engine) Context ¶
func (e *Engine) Context() *cu.BatchedContext
Context returns the BatchedContext
func (*Engine) Div ¶
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 ¶
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) ElEq ¶
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 ¶
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 ¶
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 ¶
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) Gt ¶
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 ¶
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 ¶
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 ¶
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 ¶
HasFunc returns true if the execution is external (cgo/cuda/openCL) AND the external device contains the function with the given name
func (*Engine) LoadCUDAFunc ¶
LoadCUDAFunc loads a string representing a CUDA PTX file into the engine, giving it the universe of computing functions.
func (*Engine) Lt ¶
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 ¶
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 ¶
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 ¶
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) Memcpy ¶
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) Mod ¶
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 ¶
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) Mul ¶
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 ¶
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 ¶
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 ¶
func (e *Engine) NonStdAlloc()
NonStdAlloc nothing instead of running the default built in allocator
func (*Engine) Pow ¶
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 ¶
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) ResetAllocator ¶
func (e *Engine) ResetAllocator()
ResetAllocator releases used memory of the engine
func (*Engine) Sub ¶
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 ¶
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
type External ¶
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