cuda

package
v0.0.0-...-c5f678a Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2019 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package cuda contains wrapper functions for Cuda api

Index

Constants

View Source
const (
	ActivFprop = iota
	ActivBprop
	DropoutFprop
	DropoutBprop
	BnormFpropInfer
	BnormFpropTrain
	BnormBprop
	ConvFprop
	ConvFpropBias
	ConvBpropData
	ConvBpropFilter
	ConvBpropBias
	PoolFprop
	PoolBprop
)
View Source
const (
	FwdAlgo = iota
	BwdFilterAlgo
	BwdDataAlgo
)

Variables

This section is empty.

Functions

func GetBlasError

func GetBlasError(err BlasStatus) error

Convert cuBlas status code to go error

func GetDnnError

func GetDnnError(err DnnStatus) error

Convert cuDNN status code to go error

func GetError

func GetError(err Error) error

Convert Cuda error code to go error

func OpName

func OpName(op int) string

Types

type ActivLayer

type ActivLayer struct {
	Src *Layout
	// contains filtered or unexported fields
}

Activation layer descriptor

func Activation

func Activation(typ string, shape []int) *ActivLayer

Create new activation layer

func (*ActivLayer) InShape

func (l *ActivLayer) InShape() []int

func (*ActivLayer) OutShape

func (l *ActivLayer) OutShape() []int

func (*ActivLayer) Ptr

func (l *ActivLayer) Ptr() unsafe.Pointer

func (*ActivLayer) Release

func (l *ActivLayer) Release()

type BatchNormLayer

type BatchNormLayer struct {
	Src   *Layout
	Shape *Layout
	// contains filtered or unexported fields
}

Batch normalisation layer descriptor

func BatchNorm

func BatchNorm(n, c, h, w int) *BatchNormLayer

Create new BatchNorm layer

func (*BatchNormLayer) BiasShape

func (l *BatchNormLayer) BiasShape() []int

func (*BatchNormLayer) FilterShape

func (l *BatchNormLayer) FilterShape() []int

func (*BatchNormLayer) InShape

func (l *BatchNormLayer) InShape() []int

func (*BatchNormLayer) OutShape

func (l *BatchNormLayer) OutShape() []int

func (*BatchNormLayer) Release

func (l *BatchNormLayer) Release()

type BlasStatus

type BlasStatus C.cublasStatus_t

type Buffer

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

func NewBuffer

func NewBuffer(size int) Buffer

Allocate a buffer on the GPU with given number of 32 bit words

func (Buffer) Capacity

func (b Buffer) Capacity() int

func (Buffer) Data

func (b Buffer) Data() unsafe.Pointer

func (Buffer) Release

func (b Buffer) Release()

type ConvLayer

type ConvLayer struct {
	Src    *Layout
	Dst    *Layout
	Bias   *Layout
	Filter *FilterLayout
	Algo   [3]int
	// contains filtered or unexported fields
}

Convolution layer descriptor

func Convolution

func Convolution(n, c, h, w, nFeats, filtSize, stride int, padding, noBias bool) *ConvLayer

Create new convolution layer

func (*ConvLayer) AlgoName

func (l *ConvLayer) AlgoName(algo int) string

func (*ConvLayer) BiasShape

func (l *ConvLayer) BiasShape() []int

func (*ConvLayer) FilterShape

func (l *ConvLayer) FilterShape() []int

func (*ConvLayer) InShape

func (l *ConvLayer) InShape() []int

func (*ConvLayer) Init

func (l *ConvLayer) Init(s *Stream, bpropWeights, bpropData bool) int

Initialise the layer, returns work space size needed.

func (*ConvLayer) OutShape

func (l *ConvLayer) OutShape() []int

func (*ConvLayer) Ptr

func (l *ConvLayer) Ptr() unsafe.Pointer

func (*ConvLayer) Release

func (l *ConvLayer) Release()

type Device

type Device C.int

func NewDevice

func NewDevice() Device

Get new device

type DnnStatus

type DnnStatus C.cudnnStatus_t

type DropoutLayer

type DropoutLayer struct {
	Src     *Layout
	Reserve Buffer
	States  Buffer
	// contains filtered or unexported fields
}

Dropout layer descriptor

func Dropout

func Dropout(s *Stream, ratio float64, shape []int, seed int64) *DropoutLayer

Create new dropout layer

func (*DropoutLayer) InShape

func (l *DropoutLayer) InShape() []int

func (*DropoutLayer) OutShape

func (l *DropoutLayer) OutShape() []int

func (*DropoutLayer) Ptr

func (l *DropoutLayer) Ptr() unsafe.Pointer

func (*DropoutLayer) Release

func (l *DropoutLayer) Release()

type Error

type Error C.cudaError_t

type FilterLayout

type FilterLayout struct {
	Dims []int
	// contains filtered or unexported fields
}

Filter layout type

func NewFilterLayout

func NewFilterLayout(nout, nin, h, w int) *FilterLayout

func (*FilterLayout) Ptr

func (l *FilterLayout) Ptr() unsafe.Pointer

func (*FilterLayout) Release

func (l *FilterLayout) Release()

type Layout

type Layout struct {
	Dims []int
	// contains filtered or unexported fields
}

Layout type represents a cuDNN tensor descriptor

func NewLayout

func NewLayout(n, c, h, w int) *Layout

func (*Layout) Ptr

func (l *Layout) Ptr() unsafe.Pointer

func (*Layout) Release

func (l *Layout) Release()

type PoolLayer

type PoolLayer struct {
	Src *Layout
	Dst *Layout
	// contains filtered or unexported fields
}

Max pool layer description

func Pooling

func Pooling(n, c, h, w, size, stride int, padding, average bool) *PoolLayer

Setup new max pooling or average pooling layer

func (*PoolLayer) InShape

func (l *PoolLayer) InShape() []int

func (*PoolLayer) OutShape

func (l *PoolLayer) OutShape() []int

func (*PoolLayer) Ptr

func (l *PoolLayer) Ptr() unsafe.Pointer

func (*PoolLayer) Release

func (l *PoolLayer) Release()

type Stream

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

func NewStream

func NewStream() *Stream

Allocate new Cuda stream and associate cuBlas and cuDNN context with this.

func (*Stream) Release

func (s *Stream) Release()

func (*Stream) Sync

func (s *Stream) Sync()

Jump to

Keyboard shortcuts

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