cublas

package
v0.0.0-...-741e7c9 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2017 License: BSD-2-Clause Imports: 5 Imported by: 1

Documentation

Overview

Package cublas provides bindings for the CUDA cuBLAS library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handle

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

A Handle is used to make cuBLAS calls.

A given Handle is bound to a specific cuda.Context.

func NewHandle

func NewHandle(ctx *cuda.Context) (*Handle, error)

NewHandle creates a new cuBLAS handle.

This must be called inside the cuda.Context.

func (*Handle) Dasum

func (h *Handle) Dasum(n int, x cuda.Buffer, incx int, result interface{}) error

Dasum is like Sasum, but for double-precision.

The result argument's type depends on the pointer mode. In the Host pointer mode, use *float64. In the Device pointer mode, use cuda.Buffer.

This must be called inside the cuda.Context.

func (*Handle) Daxpy

func (h *Handle) Daxpy(n int, alpha interface{}, x cuda.Buffer, incx int,
	y cuda.Buffer, incy int) error

Daxpy is like Saxpy, but for double-precision.

The argument alpha's type depends on the pointer mode. In the Host pointer mode, use float64 or *float64. In the Device pointer mode, use cuda.Buffer.

This must be called inside the cuda.Context.

func (*Handle) Ddgmm

func (h *Handle) Ddgmm(mode SideMode, m, n int, matA cuda.Buffer, lda int,
	x cuda.Buffer, incx int, matC cuda.Buffer, ldc int) error

Ddgmm is like Sdgmm, but for double-precision.

The mode argument indicates on which side the diagonal matrix should be placed.

This must be called inside the cuda.Context.

func (*Handle) Ddot

func (h *Handle) Ddot(n int, x cuda.Buffer, incx int, y cuda.Buffer, incy int,
	result interface{}) error

Ddot performs a double-precision dot product.

The result argument's type depends on the pointer mode. In the Host pointer mode, it should be *float64. In the Device pointer mode, it should be a cuda.Buffer.

This must be called inside the cuda.Context.

func (*Handle) Dgemm

func (h *Handle) Dgemm(transA, transB Operation, m, n, k int, alpha interface{},
	matA cuda.Buffer, lda int, matB cuda.Buffer, ldb int, beta interface{},
	matC cuda.Buffer, ldc int) error

Dgemm is like Sgemm, but for double-precision.

The type of alpha and beta depends on the pointer mode. In Host mode, use float64 or *float64. In Device mode, user cuda.Buffer.

This must be called inside the cuda.Context

func (*Handle) Dgemv

func (h *Handle) Dgemv(trans Operation, m, n int, alpha interface{},
	matA cuda.Buffer, lda int, x cuda.Buffer, incx int, beta interface{},
	y cuda.Buffer, incy int) error

Dgemv performs double-precision matrix-vector multiplication.

Matrices are stored in column-major order.

The leading dimension lda may not be 0.

The type of alpha and beta depends on the pointer mode. In Host mode, use float64 or *float64. In Device mode, user cuda.Buffer.

This must be called inside the cuda.Context

func (*Handle) Dnrm2

func (h *Handle) Dnrm2(n int, x cuda.Buffer, incx int, result interface{}) error

Dnrm2 is like Snrm2, but for double-precision.

The result argument's type depends on the pointer mode. In the Host pointer mode, use *float64. In the Device pointer mode, use cuda.Buffer.

This must be called inside the cuda.Context.

func (*Handle) Dscal

func (h *Handle) Dscal(n int, alpha interface{}, x cuda.Buffer, incx int) error

Dscal is like Sscal, but for double-precision.

The argument alpha's type depends on the pointer mode. In the Host pointer mode, use float64 or *float64. In the Device pointer mode, use cuda.Buffer.

This must be called inside the cuda.Context.

func (*Handle) Idamax

func (h *Handle) Idamax(n int, x cuda.Buffer, incx int, result interface{}) error

Idamax is like Isamax, but for double-precision.

The result argument's type depends on the pointer mode. In the Host pointer mode, use *int. In the Device pointer mode, use cuda.Buffer.

This must be called inside the cuda.Context.

func (*Handle) Isamax

func (h *Handle) Isamax(n int, x cuda.Buffer, incx int, result interface{}) error

Isamax gets the index of the first single-precision vector component with the max absolute value. The resulting indices start at one, not zero.

The result argument's type depends on the pointer mode. In the Host pointer mode, use *int. In the Device pointer mode, use cuda.Buffer.

This must be called inside the cuda.Context.

func (*Handle) PointerMode

func (h *Handle) PointerMode() PointerMode

PointerMode returns the current PointerMode.

This must be called inside the cuda.Context.

func (*Handle) Sasum

func (h *Handle) Sasum(n int, x cuda.Buffer, incx int, result interface{}) error

Sasum sums the absolute values of the components in a single-precision vector.

The result argument's type depends on the pointer mode. In the Host pointer mode, use *float32. In the Device pointer mode, use cuda.Buffer.

This must be called inside the cuda.Context.

func (*Handle) Saxpy

func (h *Handle) Saxpy(n int, alpha interface{}, x cuda.Buffer, incx int,
	y cuda.Buffer, incy int) error

Saxpy computes single-precision "ax plus y".

The argument alpha's type depends on the pointer mode. In the Host pointer mode, use float32 or *float32. In the Device pointer mode, use cuda.Buffer.

This must be called inside the cuda.Context.

func (*Handle) Sdgmm

func (h *Handle) Sdgmm(mode SideMode, m, n int, matA cuda.Buffer, lda int,
	x cuda.Buffer, incx int, matC cuda.Buffer, ldc int) error

Sdgmm multiplies a dense matrix by a diagonal matrix.

The mode argument indicates on which side the diagonal matrix should be placed.

This must be called inside the cuda.Context.

func (*Handle) Sdot

func (h *Handle) Sdot(n int, x cuda.Buffer, incx int, y cuda.Buffer, incy int,
	result interface{}) error

Sdot performs a single-precision dot product.

The result argument's type depends on the pointer mode. In the Host pointer mode, it should be *float32. In the Device pointer mode, it should be a cuda.Buffer.

This must be called inside the cuda.Context.

func (*Handle) SetPointerMode

func (h *Handle) SetPointerMode(p PointerMode) error

SetPointerMode updates the current PointerMode.

This must be called inside the cuda.Context.

func (*Handle) SetStream

func (h *Handle) SetStream(s *cuda.Stream) error

SetStream tells the handle which stream to use for its computations.

this must be called inside the cuda.Context.

func (*Handle) Sgemm

func (h *Handle) Sgemm(transA, transB Operation, m, n, k int, alpha interface{},
	matA cuda.Buffer, lda int, matB cuda.Buffer, ldb int, beta interface{},
	matC cuda.Buffer, ldc int) error

Sgemm performs single-precision matrix multiplication.

Matrices are stored in column-major order.

The leading dimensions lda, ldb, and ldc may not be 0.

The type of alpha and beta depends on the pointer mode. In Host mode, use float32 or *float32. In Device mode, user cuda.Buffer.

This must be called inside the cuda.Context

func (*Handle) Sgemv

func (h *Handle) Sgemv(trans Operation, m, n int, alpha interface{},
	matA cuda.Buffer, lda int, x cuda.Buffer, incx int, beta interface{},
	y cuda.Buffer, incy int) error

Sgemv performs single-precision matrix-vector multiplication.

Matrices are stored in column-major order.

The leading dimension lda may not be 0.

The type of alpha and beta depends on the pointer mode. In Host mode, use float32 or *float32. In Device mode, user cuda.Buffer.

This must be called inside the cuda.Context

func (*Handle) Snrm2

func (h *Handle) Snrm2(n int, x cuda.Buffer, incx int, result interface{}) error

Snrm2 computes the Euclidean norm of a single-precision vector.

The result argument's type depends on the pointer mode. In the Host pointer mode, use *float32. In the Device pointer mode, use cuda.Buffer.

This must be called inside the cuda.Context.

func (*Handle) Sscal

func (h *Handle) Sscal(n int, alpha interface{}, x cuda.Buffer, incx int) error

Sscal scales a single-precision vector.

The argument alpha's type depends on the pointer mode. In the Host pointer mode, use float32 or *float32. In the Device pointer mode, use cuda.Buffer.

This must be called inside the cuda.Context.

type Operation

type Operation int

Operation specifies a matrix operation.

const (
	NoTrans Operation = iota
	Trans
	ConjTrans
)

type PointerMode

type PointerMode int

PointerMode determines how BLAS APIs receive and return scaler values.

There are two types of scaler values in the API: scaler inputs and scaler return values. The current pointer mode affects both types of values.

If the pointer mode is Device, then all scaler inputs and outputs must be cuda.Buffer objects.

If the pointer mode is Host, then all scaler inputs must be float32, float64, *float32, or *float64; all scaler outputs must be *float32 or *float64.

const (
	Host PointerMode = iota
	Device
)

type SideMode

type SideMode int

A SideMode specifies the side on which a matrix should be applied to another matrix.

const (
	Left SideMode = iota
	Right
)

Jump to

Keyboard shortcuts

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