Documentation
¶
Overview ¶
Package cudss provides Go bindings for the NVIDIA cuDSS direct sparse solver, libcudss.
A solve runs as a sequence of phases against one library handle: analysis, factorization, then solve. Execute takes the phase, a Config, a Data object, the system matrix, the solution and the right-hand side.
Configuration and data parameters are read and written through the typed accessors on Config and Data. The underlying C entry points take a void pointer and a caller-supplied byte count, and the library trusts the count; the typed accessors derive it from the Go value so a mismatched size cannot be spelled.
Ownership. Matrix objects borrow: cudssMatrixCreateCsr and cudssMatrixCreateDn record the device addresses handed to them and do not copy. Those allocations, and the Matrix objects themselves, must stay live and unmodified from the analysis phase through completion of the last solve that uses them. Execute is asynchronous with respect to the host: it returns once the work is enqueued on the handle's stream, so "completion" means the stream has been synchronized, not that Execute returned. Destroying a Matrix, freeing its device memory, or reusing the buffers before that point is a use-after-free the library cannot detect.
Config and Data objects are owned by the caller and must outlive every Execute that names them. Data holds the factorization; it is bound to the handle it was created from.
Parameter accessors do not borrow. A Go slice passed to a Set accessor is read during the call and copied by cuDSS, so it may be reused or collected as soon as the call returns; a slice passed to a Get accessor is written during the call and not retained. The one exception is Data.SetUserHostInterrupt, which takes an address the library keeps and polls from its own threads: that address must not be Go memory, and must stay valid until the phases that use it have completed.
A LogFunc installed with SetLogFunc is retained until it is replaced, and is called on a thread owned by libcudss.
This package loads libcudss lazily and independently. Importing it does not open the library; the first call does. A symbol absent from the installed version reports *SymbolError rather than panicking.
Multi-GPU and multi-node setup APIs are bound; distributed execution requires a compatible communication layer and topology. See the cuDSS documentation.
Solver configuration and data ¶
Library handle ¶
- NewHandle.
- NewHandleMg.
- Handle.Close.
- GetProperty.
- Handle.SetCommLayer.
- Handle.SetDeviceMemHandler.
- Handle.SetMgStreams.
- Handle.SetStream.
- Handle.SetThreadingLayer.
Phases ¶
Device memory ¶
Logging ¶
Matrix objects ¶
- NewMatrixBatchCsr: creates a batch of CSR matrices.
- NewMatrixBatchDn: creates a batch of dense matrices.
- NewMatrixCsr.
- NewMatrixDn.
- Matrix.Close.
- Matrix.BatchCsr: retrieves a batch of CSR matrices.
- Matrix.BatchDn: retrieves a batch of dense matrices.
- Matrix.Csr.
- Matrix.DistributionRow1d.
- Matrix.Dn.
- Matrix.Format.
- Matrix.SetBatchCsrPointers: sets the CSR arrays of a batch.
- Matrix.SetBatchValues: sets the values arrays of a batch.
- Matrix.SetCsrPointers.
- Matrix.SetDistributionRow1d.
- Matrix.SetValues.
Example ¶
Example solves a 4x4 symmetric positive definite system in CSR form on one GPU, running the three phases in order: analysis, factorization, solve.
The device allocations are made with the driver package. cuDSS records the addresses it is given and does not copy them, so every allocation below has to stay alive and unmodified until the last Execute has completed on the stream -- which is why the frees are deferred to the end of the function and not to the end of each phase.
It prints an error and returns when libcudss or a CUDA device is not available, so it is useful as a compile-time check on a machine with no GPU.
package main
import (
"fmt"
"runtime"
"unsafe"
"github.com/tmc/lib/nvidia/cudss"
"github.com/tmc/lib/nvidia/driver"
)
func main() {
// A context is current on an OS thread, so keep this goroutine on the
// thread that makes it current.
runtime.LockOSThread()
defer runtime.UnlockOSThread()
if err := driver.Init(0); err != nil {
fmt.Println("CUDA unavailable:", err)
return
}
dev, err := driver.DeviceGet(0)
if err != nil {
fmt.Println("no CUDA device:", err)
return
}
ctx, err := dev.PrimaryCtxRetain()
if err != nil {
fmt.Println("context:", err)
return
}
defer dev.PrimaryCtxRelease()
if err := ctx.SetCurrent(); err != nil {
fmt.Println("context:", err)
return
}
// A is the 4x4 matrix with 4 on the diagonal and 1 on the first
// off-diagonals, stored as full (not triangular) CSR with 0-based indices.
rowOffsets := []int32{0, 2, 5, 8, 10}
colIndices := []int32{0, 1, 0, 1, 2, 1, 2, 3, 2, 3}
values := []float64{4, 1, 1, 4, 1, 1, 4, 1, 1, 4}
// b = A * [1 2 3 4].
b := []float64{6, 12, 18, 19}
x := make([]float64, 4)
upload := func(p unsafe.Pointer, n uint) (driver.DevicePtr, error) {
d, err := driver.MemAllocBytes(n)
if err != nil {
return 0, err
}
if err := d.CopyFromHostPtr(p, n); err != nil {
d.Free()
return 0, err
}
return d, nil
}
var frees []driver.DevicePtr
defer func() {
for _, d := range frees {
d.Free()
}
}()
alloc := func(p unsafe.Pointer, n uint) driver.DevicePtr {
d, err := upload(p, n)
if err != nil {
panic(err)
}
frees = append(frees, d)
return d
}
dRow := alloc(unsafe.Pointer(&rowOffsets[0]), uint(len(rowOffsets))*4)
dCol := alloc(unsafe.Pointer(&colIndices[0]), uint(len(colIndices))*4)
dVal := alloc(unsafe.Pointer(&values[0]), uint(len(values))*8)
dB := alloc(unsafe.Pointer(&b[0]), uint(len(b))*8)
dX := alloc(unsafe.Pointer(&x[0]), uint(len(x))*8)
handle, err := cudss.NewHandle()
if err != nil {
fmt.Println("cuDSS unavailable:", err)
return
}
defer handle.Close()
config, err := cudss.NewConfig()
if err != nil {
fmt.Println("config:", err)
return
}
defer config.Close()
// Every configuration parameter has a documented C type. The accessor
// takes the matching Go type and sizes the call from it, so the byte count
// the library is given always describes the storage it is given.
if err := config.SetPivotType(cudss.PivotNone); err != nil {
fmt.Println("pivot type:", err)
return
}
data, err := cudss.NewData(handle)
if err != nil {
fmt.Println("data:", err)
return
}
defer data.Destroy(handle)
a, err := cudss.NewMatrixCsr(4, 4, 10,
uintptr(dRow), 0, uintptr(dCol), uintptr(dVal),
cudss.R32I, cudss.R32I, cudss.R64F,
cudss.MtypeSpd, cudss.MviewFull, cudss.BaseZero)
if err != nil {
fmt.Println("matrix:", err)
return
}
defer a.Close()
rhs, err := cudss.NewMatrixDn(4, 1, 4, uintptr(dB), cudss.R64F, cudss.LayoutColMajor)
if err != nil {
fmt.Println("rhs:", err)
return
}
defer rhs.Close()
sol, err := cudss.NewMatrixDn(4, 1, 4, uintptr(dX), cudss.R64F, cudss.LayoutColMajor)
if err != nil {
fmt.Println("solution:", err)
return
}
defer sol.Close()
for _, phase := range []cudss.Phase{
cudss.PhaseAnalysis,
cudss.PhaseFactorization,
cudss.PhaseSolve,
} {
if err := handle.Execute(phase, config, data, a, sol, rhs); err != nil {
fmt.Printf("%v: %v\n", phase, err)
return
}
}
// Execute enqueues work; nothing above guarantees it has run.
if err := driver.CtxSynchronize(); err != nil {
fmt.Println("synchronize:", err)
return
}
if err := dX.CopyToHost(x); err != nil {
fmt.Println("download:", err)
return
}
nnz, err := data.LUNonzeros(handle)
if err != nil {
fmt.Println("lu nnz:", err)
return
}
fmt.Printf("x = %.3f, factor nnz = %d\n", x, nnz)
}
Output:
Index ¶
- func Close() error
- func ColPermutation[T ParamElement](handle Handle, d Data, dst []T) (int, error)
- func ColScaling[T ParamElement](handle Handle, d Data, dst []T) (int, error)
- func ConfigDestroy(solverConfig Config) error
- func DataArray[T ParamElement](handle Handle, data Data, param DataParam, dst []T) (int, error)
- func DataArrayAt(handle Handle, data Data, param DataParam, addr uintptr, size uintptr) (uintptr, error)
- func DataDestroy(handle Handle, solverData Data) error
- func Destroy(handle Handle) error
- func Diagonal[T ParamElement](handle Handle, d Data, dst []T) (int, error)
- func Execute(handle Handle, phase Phase, solverConfig Config, solverData Data, ...) error
- func GetProperty(propertyType LibraryPropertyType) (int32, error)
- func Has(symbol string) bool
- func HasConfigCreate() bool
- func HasConfigDestroy() bool
- func HasConfigGet() bool
- func HasConfigSet() bool
- func HasCreate() bool
- func HasCreateMg() bool
- func HasDataCreate() bool
- func HasDataDestroy() bool
- func HasDataGet() bool
- func HasDataSet() bool
- func HasDestroy() bool
- func HasExecute() bool
- func HasGetDeviceMemHandler() bool
- func HasGetProperty() bool
- func HasLoggerForceDisable() bool
- func HasLoggerOpenFile() bool
- func HasLoggerSetCallback() bool
- func HasLoggerSetLevel() bool
- func HasLoggerSetMask() bool
- func HasMatrixCreateBatchCsr() bool
- func HasMatrixCreateBatchDn() bool
- func HasMatrixCreateCsr() bool
- func HasMatrixCreateDn() bool
- func HasMatrixDestroy() bool
- func HasMatrixGetBatchCsr() bool
- func HasMatrixGetBatchDn() bool
- func HasMatrixGetCsr() bool
- func HasMatrixGetDistributionRow1d() bool
- func HasMatrixGetDn() bool
- func HasMatrixGetFormat() bool
- func HasMatrixSetBatchCsrPointers() bool
- func HasMatrixSetBatchValues() bool
- func HasMatrixSetCsrPointers() bool
- func HasMatrixSetDistributionRow1d() bool
- func HasMatrixSetValues() bool
- func HasSetCommLayer() bool
- func HasSetDeviceMemHandler() bool
- func HasSetMgStreams() bool
- func HasSetStream() bool
- func HasSetThreadingLayer() bool
- func Inertia[T ParamElement](handle Handle, d Data, dst []T) (int, error)
- func Load(path string) error
- func Loaded() bool
- func LoggerForceDisable() error
- func LoggerOpenFile(logFile string) error
- func LoggerSetCallback(callback uintptr) error
- func LoggerSetLevel(level int32) error
- func LoggerSetMask(mask int32) error
- func MatchingPermutation[T ParamElement](handle Handle, d Data, dst []T) (int, error)
- func MatrixDestroy(matrix Matrix) error
- func MatrixGetBatchCsr(matrix Matrix, batchCount *int64, nrows *HostPtr, ncols *HostPtr, nnz *HostPtr, ...) error
- func MatrixGetBatchDn(matrix Matrix, batchCount *int64, nrows *HostPtr, ncols *HostPtr, ld *HostPtr, ...) error
- func MatrixGetCsr(matrix Matrix, nrows *int64, ncols *int64, nnz *int64, rowStart *uintptr, ...) error
- func MatrixGetDistributionRow1d(matrix Matrix, firstRow *int64, lastRow *int64) error
- func MatrixGetDn(matrix Matrix, nrows *int64, ncols *int64, ld *int64, values *uintptr, ...) error
- func MatrixGetFormat(matrix Matrix) (int32, error)
- func MatrixSetBatchCsrPointers(matrix Matrix, rowOffsets driver.DevicePtr, rowEnd driver.DevicePtr, ...) error
- func MatrixSetBatchValues(matrix Matrix, values driver.DevicePtr) error
- func MatrixSetCsrPointers(matrix Matrix, rowOffsets uintptr, rowEnd uintptr, colIndices uintptr, ...) error
- func MatrixSetDistributionRow1d(matrix Matrix, firstRow int64, lastRow int64) error
- func MatrixSetValues(matrix Matrix, values uintptr) error
- func PartitionTree[T ParamElement](handle Handle, d Data, dst []T) (int, error)
- func Path() string
- func Pivots[T ParamElement](handle Handle, d Data, dst []T) (int, error)
- func ReorderColPermutation[T ParamElement](handle Handle, d Data, dst []T) (int, error)
- func ReorderRowPermutation[T ParamElement](handle Handle, d Data, dst []T) (int, error)
- func RowPermutation[T ParamElement](handle Handle, d Data, dst []T) (int, error)
- func RowScaling[T ParamElement](handle Handle, d Data, dst []T) (int, error)
- func SetCommLayer(handle Handle, commLibFileName string) error
- func SetDataArray[T ParamElement](handle Handle, data Data, param DataParam, src []T) error
- func SetDataArrayAt(handle Handle, data Data, param DataParam, addr uintptr, size uintptr) error
- func SetDeviceMemHandler(handle Handle, handler *DeviceMemHandler) error
- func SetLogFunc(fn LogFunc) error
- func SetMgStreams(handle Handle, streams *driver.Stream, streamCount int32) error
- func SetStream(handle Handle, stream driver.Stream) error
- func SetThreadingLayer(handle Handle, thrLibFileName string) error
- func SetUserPartitionTree[T ParamElement](handle Handle, d Data, src []T) error
- func SetUserPermutation[T ParamElement](handle Handle, d Data, src []T) error
- func SetUserSchurIndices[T ParamElement](handle Handle, d Data, src []T) error
- func Superpanels[T ParamElement](handle Handle, d Data, dst []T) (int, error)
- func UserPermutation[T ParamElement](handle Handle, d Data, dst []T) (int, error)
- type BindFailure
- type CallError
- type Config
- func (c *Config) Close() error
- func (c Config) DeterministicMode() (int32, error)
- func (c Config) DeviceCount() (int32, error)
- func (c Config) DeviceIndices(dst []int32) (int, error)
- func (c Config) FactorizationAlg() (FactorizationAlg, error)
- func (c Config) HostThreads() (int32, error)
- func (c Config) HybridDeviceMemoryLimit() (int64, error)
- func (c Config) HybridExecuteMode() (int32, error)
- func (c Config) HybridMemoryMode() (int32, error)
- func (c Config) IRSteps() (int32, error)
- func (c Config) IRTolerance() (float64, error)
- func (c Config) MatchingAlg() (MatchingAlg, error)
- func (c Config) MaxLUNonzeros() (int64, error)
- func (c Config) NestedDissectionLevels() (int32, error)
- func (c Config) NestedDissectionUnbalanceFactor() (int32, error)
- func (c Config) PivotEpsilon() (float64, error)
- func (c Config) PivotEpsilonAlg() (PivotEpsilonAlg, error)
- func (c Config) PivotThreshold() (float64, error)
- func (c Config) PivotType() (PivotType, error)
- func (c Config) ReorderingAlg() (ReorderingAlg, error)
- func (c Config) SchurMode() (int32, error)
- func (c Config) SetDeterministicMode(v int32) error
- func (c Config) SetDeviceCount(v int32) error
- func (c Config) SetDeviceIndices(v []int32) error
- func (c Config) SetFactorizationAlg(v FactorizationAlg) error
- func (c Config) SetHostThreads(v int32) error
- func (c Config) SetHybridDeviceMemoryLimit(v int64) error
- func (c Config) SetHybridExecuteMode(v int32) error
- func (c Config) SetHybridMemoryMode(v int32) error
- func (c Config) SetIRSteps(v int32) error
- func (c Config) SetIRTolerance(v float64) error
- func (c Config) SetMatchingAlg(v MatchingAlg) error
- func (c Config) SetMaxLUNonzeros(v int64) error
- func (c Config) SetNestedDissectionLevels(v int32) error
- func (c Config) SetNestedDissectionUnbalanceFactor(v int32) error
- func (c Config) SetPivotEpsilon(v float64) error
- func (c Config) SetPivotEpsilonAlg(v PivotEpsilonAlg) error
- func (c Config) SetPivotThreshold(v float64) error
- func (c Config) SetPivotType(v PivotType) error
- func (c Config) SetReorderingAlg(v ReorderingAlg) error
- func (c Config) SetSchurMode(v int32) error
- func (c Config) SetSolveAlg(v SolveAlg) error
- func (c Config) SetSolveMode(v int32) error
- func (c Config) SetUniformBatchIndex(v int32) error
- func (c Config) SetUniformBatchSize(v int32) error
- func (c Config) SetUseCUDARegisterMemory(v int32) error
- func (c Config) SetUseSuperpanels(v int32) error
- func (c Config) SolveAlg() (SolveAlg, error)
- func (c Config) SolveMode() (int32, error)
- func (c Config) UniformBatchIndex() (int32, error)
- func (c Config) UniformBatchSize() (int32, error)
- func (c Config) UseCUDARegisterMemory() (int32, error)
- func (c Config) UseSuperpanels() (int32, error)
- type ConfigParam
- type CudssFp64mp2
- type Data
- func (d Data) Destroy(handle Handle) error
- func (d Data) Flops(handle Handle) (int64, error)
- func (d Data) HybridDeviceMemoryMin(handle Handle) (int64, error)
- func (d Data) IRSteps(handle Handle) (int32, error)
- func (d Data) Info(handle Handle) (int32, error)
- func (d Data) LUNonzeros(handle Handle) (int64, error)
- func (d Data) MemoryEstimates(handle Handle) ([16]int64, error)
- func (d Data) SchurShape(handle Handle) ([3]int64, error)
- func (d Data) SetSchurMatrix(handle Handle, v Matrix) error
- func (d Data) SetUniformBatchMask(handle Handle, src []int64) error
- func (d Data) SetUserHostInterrupt(handle Handle, addr uintptr) error
- func (d Data) UniformBatchMask(handle Handle, dst []int64) (int, error)
- type DataParam
- type DataType
- type DeviceMemHandler
- type DistributedInterface
- type FactorizationAlg
- type Handle
- func (h *Handle) Close() error
- func (h Handle) DeviceMemHandler() (DeviceMemHandler, error)
- func (h Handle) Execute(phase Phase, solverConfig Config, solverData Data, inputMatrix Matrix, ...) error
- func (h Handle) SetCommLayer(commLibFileName string) error
- func (h Handle) SetDeviceMemHandler(handler *DeviceMemHandler) error
- func (h Handle) SetMgStreams(streams *driver.Stream, streamCount int32) error
- func (h Handle) SetStream(stream driver.Stream) error
- func (h Handle) SetThreadingLayer(thrLibFileName string) error
- type HostPtr
- type IndexBase
- type Layout
- type LibraryAttempt
- type LibraryConflictError
- type LibraryError
- type LibraryPropertyType
- type LogFunc
- type MatchingAlg
- type Matrix
- func MatrixCreateBatchCsr(batchCount int64, nrows HostPtr, ncols HostPtr, nnz HostPtr, ...) (Matrix, error)
- func MatrixCreateBatchDn(batchCount int64, nrows HostPtr, ncols HostPtr, ld HostPtr, ...) (Matrix, error)
- func MatrixCreateCsr(nrows int64, ncols int64, nnz int64, rowStart uintptr, rowEnd uintptr, ...) (Matrix, error)
- func MatrixCreateDn(nrows int64, ncols int64, ld int64, values uintptr, valueType DataType, ...) (Matrix, error)
- func NewMatrixBatchCsr(batchCount int64, nrows HostPtr, ncols HostPtr, nnz HostPtr, ...) (Matrix, error)
- func NewMatrixBatchDn(batchCount int64, nrows HostPtr, ncols HostPtr, ld HostPtr, ...) (Matrix, error)
- func NewMatrixCsr(nrows int64, ncols int64, nnz int64, rowStart uintptr, rowEnd uintptr, ...) (Matrix, error)
- func NewMatrixDn(nrows int64, ncols int64, ld int64, values uintptr, valueType DataType, ...) (Matrix, error)
- func (m Matrix) BatchCsr(batchCount *int64, nrows *HostPtr, ncols *HostPtr, nnz *HostPtr, ...) error
- func (m Matrix) BatchDn(batchCount *int64, nrows *HostPtr, ncols *HostPtr, ld *HostPtr, ...) error
- func (m *Matrix) Close() error
- func (m Matrix) Csr(nrows *int64, ncols *int64, nnz *int64, rowStart *uintptr, rowEnd *uintptr, ...) error
- func (m Matrix) DistributionRow1d(firstRow *int64, lastRow *int64) error
- func (m Matrix) Dn(nrows *int64, ncols *int64, ld *int64, values *uintptr, type_ *DataType, ...) error
- func (m Matrix) Format() (int32, error)
- func (m Matrix) SetBatchCsrPointers(rowOffsets driver.DevicePtr, rowEnd driver.DevicePtr, ...) error
- func (m Matrix) SetBatchValues(values driver.DevicePtr) error
- func (m Matrix) SetCsrPointers(rowOffsets uintptr, rowEnd uintptr, colIndices uintptr, values uintptr) error
- func (m Matrix) SetDistributionRow1d(firstRow int64, lastRow int64) error
- func (m Matrix) SetValues(values uintptr) error
- type MatrixFormat
- type MatrixType
- type MatrixViewType
- type ParamElement
- type ParamSizeError
- type Phase
- type PivotEpsilonAlg
- type PivotType
- type ReorderingAlg
- type Result
- type SolveAlg
- type SymbolError
- type ThreadingInterface
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Close ¶
func Close() error
Close unloads the library and clears all bound function pointers.
The function pointers are package-level state, so Close must not be called concurrently with any other call into this package: doing so is a use-after-free. It is intended for test teardown, not for reclaiming a live library.
func ColPermutation ¶
func ColPermutation[T ParamElement](handle Handle, d Data, dst []T) (int, error)
ColPermutation reads the final column permutation, including the effect of pivoting into dst and reports how many elements were written.
T must be the index type the system matrix was created with; nothing else checks it. dst fixes the byte count, so the call cannot write past it, and dst must be long enough for the whole parameter. handle must be the handle the Data object was created from.
func ColScaling ¶
func ColScaling[T ParamElement](handle Handle, d Data, dst []T) (int, error)
ColScaling reads the column scaling computed by matching into dst and reports how many elements were written.
T must be the real floating-point type matching the matrix value type; nothing else checks it. dst fixes the byte count, so the call cannot write past it, and dst must be long enough for the whole parameter. handle must be the handle the Data object was created from.
func ConfigDestroy ¶
ConfigDestroy wraps cudssConfigDestroy.
func DataArray ¶
DataArray reads an array-valued data parameter into dst and reports how many elements the library wrote.
dst fixes the byte count handed to the library, so the call cannot write past it. dst must be long enough for the whole parameter: cuDSS does not report a required length, and a short buffer is an error from the library, not a partial read. T must match the element type the parameter is documented to use -- the matrix index type for a permutation, the matrix value type for the diagonal -- because nothing else checks it.
dst is Go memory. Parameters the vendor documents as "host or device" may also be read into device memory, which this function cannot express; use DataArrayAt for that.
func DataArrayAt ¶
func DataArrayAt(handle Handle, data Data, param DataParam, addr uintptr, size uintptr) (uintptr, error)
DataArrayAt reads an array-valued data parameter into size bytes at addr.
addr is an address the caller owns and this package cannot see into: a device allocation from cudaMalloc, or pinned host memory. It is not Go memory. Passing the address of a Go value here is a use-after-free waiting for the collector, because a uintptr keeps nothing alive.
It reports how many bytes the library wrote.
func DataDestroy ¶
DataDestroy wraps cudssDataDestroy.
func Diagonal ¶
func Diagonal[T ParamElement](handle Handle, d Data, dst []T) (int, error)
Diagonal reads the diagonal of the factorized matrix, in the original matrix order into dst and reports how many elements were written.
T must be the value type the system matrix was created with; nothing else checks it. dst fixes the byte count, so the call cannot write past it, and dst must be long enough for the whole parameter. handle must be the handle the Data object was created from.
func Execute ¶
func Execute(handle Handle, phase Phase, solverConfig Config, solverData Data, inputMatrix Matrix, solution Matrix, rhs Matrix) error
Execute wraps cudssExecute.
func GetProperty ¶
func GetProperty(propertyType LibraryPropertyType) (int32, error)
GetProperty wraps cudssGetProperty.
func Has ¶
Has reports whether the named C symbol resolved in the loaded library, loading it first if necessary. It returns false if the library failed to load. Use it to gate on capabilities before calling into them.
func HasConfigCreate ¶
func HasConfigCreate() bool
HasConfigCreate reports whether cudssConfigCreate resolved in the loaded library.
func HasConfigDestroy ¶
func HasConfigDestroy() bool
HasConfigDestroy reports whether cudssConfigDestroy resolved in the loaded library.
func HasConfigGet ¶
func HasConfigGet() bool
HasConfigGet reports whether cudssConfigGet resolved in the loaded library.
func HasConfigSet ¶
func HasConfigSet() bool
HasConfigSet reports whether cudssConfigSet resolved in the loaded library.
func HasCreate ¶
func HasCreate() bool
HasCreate reports whether cudssCreate resolved in the loaded library.
func HasCreateMg ¶
func HasCreateMg() bool
HasCreateMg reports whether cudssCreateMg resolved in the loaded library.
func HasDataCreate ¶
func HasDataCreate() bool
HasDataCreate reports whether cudssDataCreate resolved in the loaded library.
func HasDataDestroy ¶
func HasDataDestroy() bool
HasDataDestroy reports whether cudssDataDestroy resolved in the loaded library.
func HasDataGet ¶
func HasDataGet() bool
HasDataGet reports whether cudssDataGet resolved in the loaded library.
func HasDataSet ¶
func HasDataSet() bool
HasDataSet reports whether cudssDataSet resolved in the loaded library.
func HasDestroy ¶
func HasDestroy() bool
HasDestroy reports whether cudssDestroy resolved in the loaded library.
func HasExecute ¶
func HasExecute() bool
HasExecute reports whether cudssExecute resolved in the loaded library.
func HasGetDeviceMemHandler ¶
func HasGetDeviceMemHandler() bool
HasGetDeviceMemHandler reports whether cudssGetDeviceMemHandler resolved in the loaded library.
func HasGetProperty ¶
func HasGetProperty() bool
HasGetProperty reports whether cudssGetProperty resolved in the loaded library.
func HasLoggerForceDisable ¶
func HasLoggerForceDisable() bool
HasLoggerForceDisable reports whether cudssLoggerForceDisable resolved in the loaded library.
func HasLoggerOpenFile ¶
func HasLoggerOpenFile() bool
HasLoggerOpenFile reports whether cudssLoggerOpenFile resolved in the loaded library.
func HasLoggerSetCallback ¶
func HasLoggerSetCallback() bool
HasLoggerSetCallback reports whether cudssLoggerSetCallback resolved in the loaded library.
func HasLoggerSetLevel ¶
func HasLoggerSetLevel() bool
HasLoggerSetLevel reports whether cudssLoggerSetLevel resolved in the loaded library.
func HasLoggerSetMask ¶
func HasLoggerSetMask() bool
HasLoggerSetMask reports whether cudssLoggerSetMask resolved in the loaded library.
func HasMatrixCreateBatchCsr ¶
func HasMatrixCreateBatchCsr() bool
HasMatrixCreateBatchCsr reports whether cudssMatrixCreateBatchCsr resolved in the loaded library.
func HasMatrixCreateBatchDn ¶
func HasMatrixCreateBatchDn() bool
HasMatrixCreateBatchDn reports whether cudssMatrixCreateBatchDn resolved in the loaded library.
func HasMatrixCreateCsr ¶
func HasMatrixCreateCsr() bool
HasMatrixCreateCsr reports whether cudssMatrixCreateCsr resolved in the loaded library.
func HasMatrixCreateDn ¶
func HasMatrixCreateDn() bool
HasMatrixCreateDn reports whether cudssMatrixCreateDn resolved in the loaded library.
func HasMatrixDestroy ¶
func HasMatrixDestroy() bool
HasMatrixDestroy reports whether cudssMatrixDestroy resolved in the loaded library.
func HasMatrixGetBatchCsr ¶
func HasMatrixGetBatchCsr() bool
HasMatrixGetBatchCsr reports whether cudssMatrixGetBatchCsr resolved in the loaded library.
func HasMatrixGetBatchDn ¶
func HasMatrixGetBatchDn() bool
HasMatrixGetBatchDn reports whether cudssMatrixGetBatchDn resolved in the loaded library.
func HasMatrixGetCsr ¶
func HasMatrixGetCsr() bool
HasMatrixGetCsr reports whether cudssMatrixGetCsr resolved in the loaded library.
func HasMatrixGetDistributionRow1d ¶
func HasMatrixGetDistributionRow1d() bool
HasMatrixGetDistributionRow1d reports whether cudssMatrixGetDistributionRow1d resolved in the loaded library.
func HasMatrixGetDn ¶
func HasMatrixGetDn() bool
HasMatrixGetDn reports whether cudssMatrixGetDn resolved in the loaded library.
func HasMatrixGetFormat ¶
func HasMatrixGetFormat() bool
HasMatrixGetFormat reports whether cudssMatrixGetFormat resolved in the loaded library.
func HasMatrixSetBatchCsrPointers ¶
func HasMatrixSetBatchCsrPointers() bool
HasMatrixSetBatchCsrPointers reports whether cudssMatrixSetBatchCsrPointers resolved in the loaded library.
func HasMatrixSetBatchValues ¶
func HasMatrixSetBatchValues() bool
HasMatrixSetBatchValues reports whether cudssMatrixSetBatchValues resolved in the loaded library.
func HasMatrixSetCsrPointers ¶
func HasMatrixSetCsrPointers() bool
HasMatrixSetCsrPointers reports whether cudssMatrixSetCsrPointers resolved in the loaded library.
func HasMatrixSetDistributionRow1d ¶
func HasMatrixSetDistributionRow1d() bool
HasMatrixSetDistributionRow1d reports whether cudssMatrixSetDistributionRow1d resolved in the loaded library.
func HasMatrixSetValues ¶
func HasMatrixSetValues() bool
HasMatrixSetValues reports whether cudssMatrixSetValues resolved in the loaded library.
func HasSetCommLayer ¶
func HasSetCommLayer() bool
HasSetCommLayer reports whether cudssSetCommLayer resolved in the loaded library.
func HasSetDeviceMemHandler ¶
func HasSetDeviceMemHandler() bool
HasSetDeviceMemHandler reports whether cudssSetDeviceMemHandler resolved in the loaded library.
func HasSetMgStreams ¶
func HasSetMgStreams() bool
HasSetMgStreams reports whether cudssSetMgStreams resolved in the loaded library.
func HasSetStream ¶
func HasSetStream() bool
HasSetStream reports whether cudssSetStream resolved in the loaded library.
func HasSetThreadingLayer ¶
func HasSetThreadingLayer() bool
HasSetThreadingLayer reports whether cudssSetThreadingLayer resolved in the loaded library.
func Inertia ¶
func Inertia[T ParamElement](handle Handle, d Data, dst []T) (int, error)
Inertia reads the positive and negative inertia of the system matrix, two values into dst and reports how many elements were written.
T must be the index type the system matrix was created with; nothing else checks it. dst fixes the byte count, so the call cannot write past it, and dst must be long enough for the whole parameter. handle must be the handle the Data object was created from.
func Load ¶
Load opens the shared library from path, or from the default search list when path is empty, and binds all symbols. Callers that need to direct loading should call Load before any other function; otherwise the first call loads from the default search list.
Load is idempotent: calling it again with the same path, or with an empty path, returns nil. Calling it with a different path after a successful load returns *LibraryConflictError rather than replacing the library. After a failed load, Load retries.
func Loaded ¶
func Loaded() bool
Loaded reports whether the library is currently loaded. It does not trigger a load.
func LoggerForceDisable ¶
func LoggerForceDisable() error
LoggerForceDisable wraps cudssLoggerForceDisable.
func LoggerOpenFile ¶
LoggerOpenFile wraps cudssLoggerOpenFile.
func LoggerSetCallback ¶
LoggerSetCallback wraps cudssLoggerSetCallback.
func LoggerSetLevel ¶
LoggerSetLevel wraps cudssLoggerSetLevel.
func MatchingPermutation ¶
func MatchingPermutation[T ParamElement](handle Handle, d Data, dst []T) (int, error)
MatchingPermutation reads the matching column permutation, when matching is enabled into dst and reports how many elements were written.
T must be the index type the system matrix was created with; nothing else checks it. dst fixes the byte count, so the call cannot write past it, and dst must be long enough for the whole parameter. handle must be the handle the Data object was created from.
func MatrixDestroy ¶
MatrixDestroy wraps cudssMatrixDestroy.
func MatrixGetBatchCsr ¶
func MatrixGetBatchCsr(matrix Matrix, batchCount *int64, nrows *HostPtr, ncols *HostPtr, nnz *HostPtr, rowStart *driver.DevicePtr, rowEnd *driver.DevicePtr, colIndices *driver.DevicePtr, values *driver.DevicePtr, offsetType *DataType, indexType *DataType, valueType *DataType, mtype *MatrixType, mview *MatrixViewType, indexBase *IndexBase) error
MatrixGetBatchCsr retrieves a batch of CSR matrices.
The rowStart, rowEnd, colIndices, and values output slots receive addresses of device arrays whose elements are device pointers. See https://docs.nvidia.com/cuda/cudss/functions.html#cudssmatrixgetbatchcsr.
Wraps cudssMatrixGetBatchCsr.
func MatrixGetBatchDn ¶
func MatrixGetBatchDn(matrix Matrix, batchCount *int64, nrows *HostPtr, ncols *HostPtr, ld *HostPtr, values *driver.DevicePtr, indexType *DataType, valueType *DataType, layout *Layout) error
MatrixGetBatchDn retrieves a batch of dense matrices.
The values output slots receive addresses of device arrays whose elements are device pointers. See https://docs.nvidia.com/cuda/cudss/functions.html#cudssmatrixgetbatchdn.
Wraps cudssMatrixGetBatchDn.
func MatrixGetCsr ¶
func MatrixGetCsr(matrix Matrix, nrows *int64, ncols *int64, nnz *int64, rowStart *uintptr, rowEnd *uintptr, colIndices *uintptr, values *uintptr, offsetType *DataType, indexType *DataType, valueType *DataType, mtype *MatrixType, mview *MatrixViewType, indexBase *IndexBase) error
MatrixGetCsr wraps cudssMatrixGetCsr.
func MatrixGetDistributionRow1d ¶
MatrixGetDistributionRow1d wraps cudssMatrixGetDistributionRow1d.
func MatrixGetDn ¶
func MatrixGetDn(matrix Matrix, nrows *int64, ncols *int64, ld *int64, values *uintptr, type_ *DataType, layout *Layout) error
MatrixGetDn wraps cudssMatrixGetDn.
func MatrixGetFormat ¶
MatrixGetFormat wraps cudssMatrixGetFormat.
func MatrixSetBatchCsrPointers ¶
func MatrixSetBatchCsrPointers(matrix Matrix, rowOffsets driver.DevicePtr, rowEnd driver.DevicePtr, colIndices driver.DevicePtr, values driver.DevicePtr) error
MatrixSetBatchCsrPointers sets the CSR arrays of a batch.
The rowOffsets, rowEnd, colIndices, and values arguments are device addresses of arrays whose elements are device pointers. Keep the arrays and their data valid until the matrix is closed and its stream work completes. See https://docs.nvidia.com/cuda/cudss/functions.html#cudssmatrixsetbatchcsrpointers.
Wraps cudssMatrixSetBatchCsrPointers.
func MatrixSetBatchValues ¶
MatrixSetBatchValues sets the values arrays of a batch.
The values arguments are device addresses of arrays whose elements are device pointers. Keep the arrays and their data valid until the matrix is closed and its stream work completes. See https://docs.nvidia.com/cuda/cudss/functions.html#cudssmatrixsetbatchvalues.
Wraps cudssMatrixSetBatchValues.
func MatrixSetCsrPointers ¶
func MatrixSetCsrPointers(matrix Matrix, rowOffsets uintptr, rowEnd uintptr, colIndices uintptr, values uintptr) error
MatrixSetCsrPointers wraps cudssMatrixSetCsrPointers.
func MatrixSetDistributionRow1d ¶
MatrixSetDistributionRow1d wraps cudssMatrixSetDistributionRow1d.
func MatrixSetValues ¶
MatrixSetValues wraps cudssMatrixSetValues.
func PartitionTree ¶
func PartitionTree[T ParamElement](handle Handle, d Data, dst []T) (int, error)
PartitionTree reads the nested dissection partition tree computed during reordering into dst and reports how many elements were written.
T must be the index type the system matrix was created with; nothing else checks it. dst fixes the byte count, so the call cannot write past it, and dst must be long enough for the whole parameter. handle must be the handle the Data object was created from.
func Path ¶
func Path() string
Path returns the path or name the loaded library was opened from, or the empty string if no library is loaded.
func Pivots ¶
func Pivots[T ParamElement](handle Handle, d Data, dst []T) (int, error)
Pivots reads the number of pivots encountered during factorization into dst and reports how many elements were written.
T must be the index type the system matrix was created with; nothing else checks it. dst fixes the byte count, so the call cannot write past it, and dst must be long enough for the whole parameter. handle must be the handle the Data object was created from.
func ReorderColPermutation ¶
func ReorderColPermutation[T ParamElement](handle Handle, d Data, dst []T) (int, error)
ReorderColPermutation reads the column permutation Q after reordering, such that A[P,Q] is factorized into dst and reports how many elements were written.
T must be the index type the system matrix was created with; nothing else checks it. dst fixes the byte count, so the call cannot write past it, and dst must be long enough for the whole parameter. handle must be the handle the Data object was created from.
func ReorderRowPermutation ¶
func ReorderRowPermutation[T ParamElement](handle Handle, d Data, dst []T) (int, error)
ReorderRowPermutation reads the row permutation P after reordering, such that A[P,Q] is factorized into dst and reports how many elements were written.
T must be the index type the system matrix was created with; nothing else checks it. dst fixes the byte count, so the call cannot write past it, and dst must be long enough for the whole parameter. handle must be the handle the Data object was created from.
func RowPermutation ¶
func RowPermutation[T ParamElement](handle Handle, d Data, dst []T) (int, error)
RowPermutation reads the final row permutation, including the effect of pivoting into dst and reports how many elements were written.
T must be the index type the system matrix was created with; nothing else checks it. dst fixes the byte count, so the call cannot write past it, and dst must be long enough for the whole parameter. handle must be the handle the Data object was created from.
func RowScaling ¶
func RowScaling[T ParamElement](handle Handle, d Data, dst []T) (int, error)
RowScaling reads the row scaling computed by matching into dst and reports how many elements were written.
T must be the real floating-point type matching the matrix value type; nothing else checks it. dst fixes the byte count, so the call cannot write past it, and dst must be long enough for the whole parameter. handle must be the handle the Data object was created from.
func SetCommLayer ¶
SetCommLayer wraps cudssSetCommLayer.
func SetDataArray ¶
func SetDataArray[T ParamElement](handle Handle, data Data, param DataParam, src []T) error
SetDataArray writes an array-valued data parameter from src.
src is Go memory and is read during the call. cuDSS documents that the arrays it accepts this way -- the user permutation, the user partition tree, the Schur indices -- are copied into an internal buffer, so src may be reused or collected once SetDataArray returns. Use SetDataArrayAt for a device address.
func SetDataArrayAt ¶
SetDataArrayAt writes an array-valued data parameter from size bytes at addr. See DataArrayAt on what addr may be.
func SetDeviceMemHandler ¶
func SetDeviceMemHandler(handle Handle, handler *DeviceMemHandler) error
SetDeviceMemHandler wraps cudssSetDeviceMemHandler.
func SetLogFunc ¶
SetLogFunc installs fn as the destination for cuDSS log records and reports whether the library accepted it.
The first call registers a C trampoline with the library. That trampoline stays registered: SetLogFunc(nil) stops delivery to Go without unregistering it, because handing libcudss a null callback pointer is not a documented way to turn logging off. LoggerForceDisable is the vendor's own off switch, and LoggerSetLevel and LoggerSetMask select what is produced.
fn is retained until it is replaced. Neither fn nor anything it closes over may be assumed collectable while it is installed.
func SetMgStreams ¶
SetMgStreams wraps cudssSetMgStreams.
func SetThreadingLayer ¶
SetThreadingLayer wraps cudssSetThreadingLayer.
func SetUserPartitionTree ¶
func SetUserPartitionTree[T ParamElement](handle Handle, d Data, src []T) error
SetUserPartitionTree sets a nested dissection partition tree to use instead of computing one.
T must be the index type the system matrix was created with. src is read during the call and copied by cuDSS, so it may be reused afterwards. handle must be the handle the Data object was created from.
func SetUserPermutation ¶
func SetUserPermutation[T ParamElement](handle Handle, d Data, src []T) error
SetUserPermutation sets a permutation of length n to use instead of running a reordering algorithm.
T must be the index type the system matrix was created with. src is read during the call and copied by cuDSS, so it may be reused afterwards. handle must be the handle the Data object was created from.
func SetUserSchurIndices ¶
func SetUserSchurIndices[T ParamElement](handle Handle, d Data, src []T) error
SetUserSchurIndices sets an array of length n marking the rows and columns of the Schur complement with 1.
T must be the index type the system matrix was created with. src is read during the call and copied by cuDSS, so it may be reused afterwards. handle must be the handle the Data object was created from.
func Superpanels ¶
func Superpanels[T ParamElement](handle Handle, d Data, dst []T) (int, error)
Superpanels reads the number of superpanels in the factorization into dst and reports how many elements were written.
T must be the index type the system matrix was created with; nothing else checks it. dst fixes the byte count, so the call cannot write past it, and dst must be long enough for the whole parameter. handle must be the handle the Data object was created from.
func UserPermutation ¶
func UserPermutation[T ParamElement](handle Handle, d Data, dst []T) (int, error)
UserPermutation reads a permutation of length n to use instead of running a reordering algorithm into dst and reports how many elements were written.
T must be the index type the system matrix was created with; nothing else checks it. dst fixes the byte count, so the call cannot write past it, and dst must be long enough for the whole parameter. handle must be the handle the Data object was created from.
Types ¶
type BindFailure ¶
BindFailure names a symbol the loaded library exports but that could not be bound, and why.
func BindFailures ¶
func BindFailures() []BindFailure
BindFailures returns the symbols the loaded library exports that could not be bound, sorted by symbol name, or nil if every exported symbol bound. Calling one of these reports *SymbolError with the same Err.
A load that reports no error can still leave symbols unbound: the library is fine and the signatures are not representable here. Call this after Load to find that out at once rather than one call site at a time. It does not trigger a load, and returns nil if none has happened.
type CallError ¶
CallError reports that a library call returned a failure result.
Unwrap returns Result, so errors.Is(err, c) reports whether the call returned the Result constant c, and errors.As(err, &r) with r of type Result recovers the code.
type Config ¶
type Config uintptr
Config is an opaque handle for cudssConfig_t.
func (*Config) Close ¶
Close wraps cudssConfigDestroy.
If c is zero, Close returns nil. Otherwise Close sets c to zero when the call succeeds and leaves it unchanged when it fails. Only c is zeroed: a copy of it still refers to the released object.
func (Config) DeterministicMode ¶
DeterministicMode reports whether the factorization is bitwise reproducible; 0 disables, the default.
It reads int32 (int) from CUDSS_CONFIG_DETERMINISTIC_MODE.
func (Config) DeviceCount ¶
DeviceCount reports the number of devices for multi-GPU execution.
It reads int32 (int) from CUDSS_CONFIG_DEVICE_COUNT.
func (Config) DeviceIndices ¶
DeviceIndices reads the device indices for multi-GPU execution, one per configured device into dst and reports how many elements were written.
func (Config) FactorizationAlg ¶
func (c Config) FactorizationAlg() (FactorizationAlg, error)
FactorizationAlg reports the factorization algorithm.
It reads FactorizationAlg (cudssFactorizationAlg_t) from CUDSS_CONFIG_FACTORIZATION_ALG.
func (Config) HostThreads ¶
HostThreads reports the number of host threads the threading layer may use.
It reads int32 (int) from CUDSS_CONFIG_HOST_NTHREADS.
func (Config) HybridDeviceMemoryLimit ¶
HybridDeviceMemoryLimit reports the device memory limit in bytes for the hybrid memory mode.
It reads int64 (int64_t) from CUDSS_CONFIG_HYBRID_DEVICE_MEMORY_LIMIT.
func (Config) HybridExecuteMode ¶
HybridExecuteMode reports whether part of the factorization runs on the host; 0 disables, the default.
It reads int32 (int) from CUDSS_CONFIG_HYBRID_EXECUTE_MODE.
func (Config) HybridMemoryMode ¶
HybridMemoryMode reports whether factors may be held in host memory; 0 disables, the default.
It reads int32 (int) from CUDSS_CONFIG_HYBRID_MEMORY_MODE.
func (Config) IRSteps ¶
IRSteps reports the maximum number of iterative refinement steps.
It reads int32 (int) from CUDSS_CONFIG_IR_N_STEPS.
func (Config) IRTolerance ¶
IRTolerance reports the iterative refinement convergence tolerance.
It reads float64 (double) from CUDSS_CONFIG_IR_TOL.
func (Config) MatchingAlg ¶
func (c Config) MatchingAlg() (MatchingAlg, error)
MatchingAlg reports the matching algorithm; matching is disabled by default.
It reads MatchingAlg (cudssMatchingAlg_t) from CUDSS_CONFIG_MATCHING_ALG.
func (Config) MaxLUNonzeros ¶
MaxLUNonzeros reports an upper bound on the number of nonzeros in L and U.
It reads int64 (int64_t) from CUDSS_CONFIG_MAX_LU_NNZ.
func (Config) NestedDissectionLevels ¶
NestedDissectionLevels reports the number of levels for nested dissection reordering.
It reads int32 (int) from CUDSS_CONFIG_ND_NLEVELS.
func (Config) NestedDissectionUnbalanceFactor ¶
NestedDissectionUnbalanceFactor reports the nested dissection unbalance factor, in percent.
It reads int32 (int) from CUDSS_CONFIG_ND_UBFACTOR.
func (Config) PivotEpsilon ¶
PivotEpsilon reports the value a pivot smaller than the threshold is replaced by.
It reads float64 (double) from CUDSS_CONFIG_PIVOT_EPSILON.
func (Config) PivotEpsilonAlg ¶
func (c Config) PivotEpsilonAlg() (PivotEpsilonAlg, error)
PivotEpsilonAlg reports how the pivot epsilon replacement value is computed.
It reads PivotEpsilonAlg (cudssPivotEpsilonAlg_t) from CUDSS_CONFIG_PIVOT_EPSILON_ALG.
func (Config) PivotThreshold ¶
PivotThreshold reports the pivoting threshold.
It reads float64 (double) from CUDSS_CONFIG_PIVOT_THRESHOLD.
func (Config) PivotType ¶
PivotType reports the pivoting strategy.
It reads PivotType (cudssPivotType_t) from CUDSS_CONFIG_PIVOT_TYPE.
func (Config) ReorderingAlg ¶
func (c Config) ReorderingAlg() (ReorderingAlg, error)
ReorderingAlg reports the reordering algorithm used to reduce fill-in.
It reads ReorderingAlg (cudssReorderingAlg_t) from CUDSS_CONFIG_REORDERING_ALG.
func (Config) SchurMode ¶
SchurMode reports whether the Schur complement is computed; 0 disables, the default.
It reads int32 (int) from CUDSS_CONFIG_SCHUR_MODE.
func (Config) SetDeterministicMode ¶
SetDeterministicMode sets whether the factorization is bitwise reproducible; 0 disables, the default.
It writes int32 (int) to CUDSS_CONFIG_DETERMINISTIC_MODE.
func (Config) SetDeviceCount ¶
SetDeviceCount sets the number of devices for multi-GPU execution.
It writes int32 (int) to CUDSS_CONFIG_DEVICE_COUNT.
func (Config) SetDeviceIndices ¶
SetDeviceIndices sets the device indices for multi-GPU execution, one per configured device.
The slice fixes the byte count, so the call cannot write past it. The elements are int32 (int). cuDSS reads them during the call.
func (Config) SetFactorizationAlg ¶
func (c Config) SetFactorizationAlg(v FactorizationAlg) error
SetFactorizationAlg sets the factorization algorithm.
It writes FactorizationAlg (cudssFactorizationAlg_t) to CUDSS_CONFIG_FACTORIZATION_ALG.
func (Config) SetHostThreads ¶
SetHostThreads sets the number of host threads the threading layer may use.
It writes int32 (int) to CUDSS_CONFIG_HOST_NTHREADS.
func (Config) SetHybridDeviceMemoryLimit ¶
SetHybridDeviceMemoryLimit sets the device memory limit in bytes for the hybrid memory mode.
It writes int64 (int64_t) to CUDSS_CONFIG_HYBRID_DEVICE_MEMORY_LIMIT.
func (Config) SetHybridExecuteMode ¶
SetHybridExecuteMode sets whether part of the factorization runs on the host; 0 disables, the default.
It writes int32 (int) to CUDSS_CONFIG_HYBRID_EXECUTE_MODE.
func (Config) SetHybridMemoryMode ¶
SetHybridMemoryMode sets whether factors may be held in host memory; 0 disables, the default.
It writes int32 (int) to CUDSS_CONFIG_HYBRID_MEMORY_MODE.
func (Config) SetIRSteps ¶
SetIRSteps sets the maximum number of iterative refinement steps.
It writes int32 (int) to CUDSS_CONFIG_IR_N_STEPS.
func (Config) SetIRTolerance ¶
SetIRTolerance sets the iterative refinement convergence tolerance.
It writes float64 (double) to CUDSS_CONFIG_IR_TOL.
func (Config) SetMatchingAlg ¶
func (c Config) SetMatchingAlg(v MatchingAlg) error
SetMatchingAlg sets the matching algorithm; matching is disabled by default.
It writes MatchingAlg (cudssMatchingAlg_t) to CUDSS_CONFIG_MATCHING_ALG.
func (Config) SetMaxLUNonzeros ¶
SetMaxLUNonzeros sets an upper bound on the number of nonzeros in L and U.
It writes int64 (int64_t) to CUDSS_CONFIG_MAX_LU_NNZ.
func (Config) SetNestedDissectionLevels ¶
SetNestedDissectionLevels sets the number of levels for nested dissection reordering.
It writes int32 (int) to CUDSS_CONFIG_ND_NLEVELS.
func (Config) SetNestedDissectionUnbalanceFactor ¶
SetNestedDissectionUnbalanceFactor sets the nested dissection unbalance factor, in percent.
It writes int32 (int) to CUDSS_CONFIG_ND_UBFACTOR.
func (Config) SetPivotEpsilon ¶
SetPivotEpsilon sets the value a pivot smaller than the threshold is replaced by.
It writes float64 (double) to CUDSS_CONFIG_PIVOT_EPSILON.
func (Config) SetPivotEpsilonAlg ¶
func (c Config) SetPivotEpsilonAlg(v PivotEpsilonAlg) error
SetPivotEpsilonAlg sets how the pivot epsilon replacement value is computed.
It writes PivotEpsilonAlg (cudssPivotEpsilonAlg_t) to CUDSS_CONFIG_PIVOT_EPSILON_ALG.
func (Config) SetPivotThreshold ¶
SetPivotThreshold sets the pivoting threshold.
It writes float64 (double) to CUDSS_CONFIG_PIVOT_THRESHOLD.
func (Config) SetPivotType ¶
SetPivotType sets the pivoting strategy.
It writes PivotType (cudssPivotType_t) to CUDSS_CONFIG_PIVOT_TYPE.
func (Config) SetReorderingAlg ¶
func (c Config) SetReorderingAlg(v ReorderingAlg) error
SetReorderingAlg sets the reordering algorithm used to reduce fill-in.
It writes ReorderingAlg (cudssReorderingAlg_t) to CUDSS_CONFIG_REORDERING_ALG.
func (Config) SetSchurMode ¶
SetSchurMode sets whether the Schur complement is computed; 0 disables, the default.
It writes int32 (int) to CUDSS_CONFIG_SCHUR_MODE.
func (Config) SetSolveAlg ¶
SetSolveAlg sets the solve algorithm.
It writes SolveAlg (cudssSolveAlg_t) to CUDSS_CONFIG_SOLVE_ALG.
func (Config) SetSolveMode ¶
SetSolveMode sets the solve mode for transpose and conjugate-transpose solves.
It writes int32 (int) to CUDSS_CONFIG_SOLVE_MODE.
func (Config) SetUniformBatchIndex ¶
SetUniformBatchIndex sets the single uniform-batch entry to process, instead of all of them.
It writes int32 (int) to CUDSS_CONFIG_UBATCH_INDEX.
func (Config) SetUniformBatchSize ¶
SetUniformBatchSize sets the number of systems in a uniform batch; must be set before the analysis phase.
It writes int32 (int) to CUDSS_CONFIG_UBATCH_SIZE.
func (Config) SetUseCUDARegisterMemory ¶
SetUseCUDARegisterMemory sets whether host allocations are registered with CUDA; enabled by default.
It writes int32 (int) to CUDSS_CONFIG_USE_CUDA_REGISTER_MEMORY.
func (Config) SetUseSuperpanels ¶
SetUseSuperpanels sets whether superpanels are used; enabled by default.
It writes int32 (int) to CUDSS_CONFIG_USE_SUPERPANELS.
func (Config) SolveAlg ¶
SolveAlg reports the solve algorithm.
It reads SolveAlg (cudssSolveAlg_t) from CUDSS_CONFIG_SOLVE_ALG.
func (Config) SolveMode ¶
SolveMode reports the solve mode for transpose and conjugate-transpose solves.
It reads int32 (int) from CUDSS_CONFIG_SOLVE_MODE.
func (Config) UniformBatchIndex ¶
UniformBatchIndex reports the single uniform-batch entry to process, instead of all of them.
It reads int32 (int) from CUDSS_CONFIG_UBATCH_INDEX.
func (Config) UniformBatchSize ¶
UniformBatchSize reports the number of systems in a uniform batch; must be set before the analysis phase.
It reads int32 (int) from CUDSS_CONFIG_UBATCH_SIZE.
func (Config) UseCUDARegisterMemory ¶
UseCUDARegisterMemory reports whether host allocations are registered with CUDA; enabled by default.
It reads int32 (int) from CUDSS_CONFIG_USE_CUDA_REGISTER_MEMORY.
func (Config) UseSuperpanels ¶
UseSuperpanels reports whether superpanels are used; enabled by default.
It reads int32 (int) from CUDSS_CONFIG_USE_SUPERPANELS.
type ConfigParam ¶
type ConfigParam int32
ConfigParam represents cudssConfigParam_t.
const ( ConfigReorderingAlg ConfigParam = 0 ConfigFactorizationAlg ConfigParam = 1 ConfigSolveAlg ConfigParam = 2 ConfigMatchingAlg ConfigParam = 3 // not used by default ConfigSolveMode ConfigParam = 4 // not supported right now (for transpose, conj transpose solves) (only off) ConfigIrNSteps ConfigParam = 5 ConfigIrTol ConfigParam = 6 ConfigPivotType ConfigParam = 7 ConfigPivotThreshold ConfigParam = 8 ConfigPivotEpsilon ConfigParam = 9 ConfigMaxLuNnz ConfigParam = 10 // only for [ReorderingAlgBtfColamd] and [ReorderingAlgColamd] reordering algorithms ConfigHybridMemoryMode ConfigParam = 11 // by default: disabled ConfigHybridDeviceMemoryLimit ConfigParam = 12 ConfigUseCudaRegisterMemory ConfigParam = 13 // by default: enabled ConfigHostNthreads ConfigParam = 14 ConfigHybridExecuteMode ConfigParam = 15 // default: 0 - disabled ConfigPivotEpsilonAlg ConfigParam = 16 ConfigNdNlevels ConfigParam = 17 ConfigUbatchSize ConfigParam = 18 // "U" - stands for Uniform ConfigUbatchIndex ConfigParam = 19 ConfigUseSuperpanels ConfigParam = 20 // by default: enabled ConfigDeviceCount ConfigParam = 21 ConfigDeviceIndices ConfigParam = 22 ConfigSchurMode ConfigParam = 23 ConfigDeterministicMode ConfigParam = 24 ConfigNdUbfactor ConfigParam = 25 // unbalance factor (in percent) for nested dissection )
func (ConfigParam) ParamType ¶
func (e ConfigParam) ParamType() string
ParamType returns the C type the cuDSS reference documents for a configuration parameter, or the empty string for a parameter this package does not model. It is documentation in executable form: the type decides how many bytes the library reads or writes, and an accessor whose Go type disagrees with it is a memory bug, not a typo.
func (ConfigParam) String ¶
func (e ConfigParam) String() string
String returns the constant name, or a numeric representation for unknown values.
type CudssFp64mp2 ¶
CudssFp64mp2 represents cudss_fp64mp2_t.
C declares cudss_fp64mp2_t with 16-byte alignment, which a Go type cannot express: a CudssFp64mp2 declared as a variable or allocated with new is at most 8-byte aligned. NewCudssFp64mp2 returns a zero CudssFp64mp2 at a 16-byte-aligned address, for when its address is handed to something that relies on the C alignment.
func NewCudssFp64mp2 ¶
func NewCudssFp64mp2() *CudssFp64mp2
NewCudssFp64mp2 returns a pointer to a zero CudssFp64mp2 aligned to 16 bytes, as C aligns cudss_fp64mp2_t. The alignment belongs to the storage: a copy of the value is aligned only as Go aligns a CudssFp64mp2.
type Data ¶
type Data uintptr
Data is an opaque handle for cudssData_t.
func (Data) Destroy ¶
Destroy wraps cudssDataDestroy.
It is not named Close because it takes more than the handle.
func (Data) Flops ¶
Flops reports the floating-point operation count the factorization reports.
It reads int64 (int64_t) from CUDSS_DATA_FLOPS. handle must be the handle the Data object was created from.
func (Data) HybridDeviceMemoryMin ¶
HybridDeviceMemoryMin reports the smallest device memory limit, in bytes, the hybrid memory mode accepts.
It reads int64 (int64_t) from CUDSS_DATA_HYBRID_DEVICE_MEMORY_MIN. handle must be the handle the Data object was created from.
func (Data) IRSteps ¶
IRSteps reports the number of iterative refinement steps actually performed.
It reads int32 (int) from CUDSS_DATA_IR_N_STEPS. handle must be the handle the Data object was created from.
func (Data) Info ¶
Info reports the device-side status of the last phase; zero means success.
It reads int32 (int) from CUDSS_DATA_INFO. handle must be the handle the Data object was created from.
func (Data) LUNonzeros ¶
LUNonzeros reports the number of nonzeros in the computed L and U factors.
It reads int64 (int64_t) from CUDSS_DATA_LU_NNZ. handle must be the handle the Data object was created from.
func (Data) MemoryEstimates ¶
MemoryEstimates reports host and device memory estimates in bytes for the memory mode of the last analysis.
It reads 16 elements of int64 (int64_t) from CUDSS_DATA_MEMORY_ESTIMATES. handle must be the handle the Data object was created from.
func (Data) SchurShape ¶
SchurShape reports the shape of the Schur complement, for sizing the matrix to receive it.
It reads 3 elements of int64 (int64_t) from CUDSS_DATA_SCHUR_SHAPE. handle must be the handle the Data object was created from.
func (Data) SetSchurMatrix ¶
SetSchurMatrix sets the caller-created matrix the Schur complement is written into.
It writes Matrix (cudssMatrix_t) to CUDSS_DATA_SCHUR_MATRIX. handle must be the handle the Data object was created from.
func (Data) SetUniformBatchMask ¶
SetUniformBatchMask sets a 0/1 array selecting which systems of a uniform batch to process.
The elements are int64 (int64_t). src is read during the call and copied by cuDSS, so it may be reused afterwards. handle must be the handle the Data object was created from.
func (Data) SetUserHostInterrupt ¶
SetUserHostInterrupt sets the address of a 4-byte flag the library polls to abort a running phase.
addr is pointer to a 4-byte integer. It is not Go memory: cuDSS retains the address across phases and polls it from its own threads, so a Go pointer converted to uintptr here is invisible to the garbage collector and may be moved or freed under the library. Pass an address from a C or CUDA allocation, or 0 to disable the check. handle must be the handle the Data object was created from.
func (Data) UniformBatchMask ¶
UniformBatchMask reads a 0/1 array selecting which systems of a uniform batch to process into dst and reports how many elements were written.
The elements are int64 (int64_t). dst fixes the byte count, so the call cannot write past it. handle must be the handle the Data object was created from.
type DataParam ¶
type DataParam int32
DataParam represents cudssDataParam_t.
const ( DataInfo DataParam = 0 // (out) DataLuNnz DataParam = 1 // (out) DataNpivots DataParam = 2 // (out) DataInertia DataParam = 3 // (out, non-trivial for non-positive-definite matrices) DataPermReorderRow DataParam = 4 // (out) DataPermReorderCol DataParam = 5 // (out) DataPermRow DataParam = 6 // (out, supported only for [ReorderingAlgBtfColamd] and [ReorderingAlgColamd] reordering algorithms) DataPermCol DataParam = 7 // (out, supported only for [ReorderingAlgBtfColamd] and [ReorderingAlgColamd] reordering algorithms) DataDiag DataParam = 8 // (out) DataUserPerm DataParam = 9 // (in, out) for the user to provide a permutation or retrieve the provided permutation DataHybridDeviceMemoryMin DataParam = 10 DataCommDevice DataParam = 11 // (in) communicator for device buffers DataCommHost DataParam = 12 // (in) communicator for host buffers DataMemoryEstimates DataParam = 13 DataPermMatching DataParam = 14 // (out, supported only when matching is enabled) DataScaleRow DataParam = 15 // (out, supported only when matching is enabled) DataScaleCol DataParam = 16 // (out, supported only when matching with scaling is enabled) DataNsuperpanels DataParam = 17 // (out) DataUserSchurIndices DataParam = 18 // (in) indices[n] (1s for Schur complement, 0s for the rest) DataSchurShape DataParam = 19 // (out) int64_t shape[3] DataSchurMatrix DataParam = 20 // (out) [Matrix] DataUserNdPartitionTree DataParam = 21 DataNdPartitionTree DataParam = 22 // (out) retrieves the partition tree information DataUserHostInterrupt DataParam = 23 DataIrNSteps DataParam = 24 // (out) number of iterative refinement steps performed DataUbatchMask DataParam = 25 // (in, out) integer array (0/1 values) to selectively process matrices in uniform batch DataFlops DataParam = 26 // (out) )
type DeviceMemHandler ¶
DeviceMemHandler represents cudssDeviceMemHandler_t.
func GetDeviceMemHandler ¶
func GetDeviceMemHandler(handle Handle) (DeviceMemHandler, error)
GetDeviceMemHandler wraps cudssGetDeviceMemHandler.
type DistributedInterface ¶
type DistributedInterface struct {
CudssCommRankDevice uintptr
CudssCommSizeDevice uintptr
CudssSendDevice uintptr
CudssRecvDevice uintptr
CudssBcastDevice uintptr
CudssReduceDevice uintptr
CudssAllreduceDevice uintptr
CudssScattervDevice uintptr
CudssCommSplitDevice uintptr
CudssCommFreeDevice uintptr
CudssCommRankHost uintptr
CudssCommSizeHost uintptr
CudssSendHost uintptr
CudssRecvHost uintptr
CudssBcastHost uintptr
CudssReduceHost uintptr
CudssAllreduceHost uintptr
CudssScattervHost uintptr
CudssCommSplitHost uintptr
CudssCommFreeHost uintptr
CudssDistributedGetProperty uintptr
}
DistributedInterface represents interface to communication layer.
All send and receive bufferes supposed to be device-accessible so MPI must be CUDA aware.
type FactorizationAlg ¶
type FactorizationAlg int32
FactorizationAlg represents cudssFactorizationAlg_t.
const ( FactorizationAlgDefault FactorizationAlg = 0 FactorizationAlgMultiblock FactorizationAlg = 1 FactorizationAlgGeneral FactorizationAlg = 2 )
func (FactorizationAlg) String ¶
func (e FactorizationAlg) String() string
String returns the constant name, or a numeric representation for unknown values.
type Handle ¶
type Handle uintptr
Handle is an opaque handle for cudssHandle_t.
func NewHandleMg ¶
NewHandleMg wraps cudssCreateMg.
func (*Handle) Close ¶
Close wraps cudssDestroy.
If h is zero, Close returns nil. Otherwise Close sets h to zero when the call succeeds and leaves it unchanged when it fails. Only h is zeroed: a copy of it still refers to the released object.
func (Handle) DeviceMemHandler ¶
func (h Handle) DeviceMemHandler() (DeviceMemHandler, error)
DeviceMemHandler wraps cudssGetDeviceMemHandler.
func (Handle) Execute ¶
func (h Handle) Execute(phase Phase, solverConfig Config, solverData Data, inputMatrix Matrix, solution Matrix, rhs Matrix) error
Execute wraps cudssExecute.
func (Handle) SetCommLayer ¶
SetCommLayer wraps cudssSetCommLayer.
func (Handle) SetDeviceMemHandler ¶
func (h Handle) SetDeviceMemHandler(handler *DeviceMemHandler) error
SetDeviceMemHandler wraps cudssSetDeviceMemHandler.
func (Handle) SetMgStreams ¶
SetMgStreams wraps cudssSetMgStreams.
func (Handle) SetThreadingLayer ¶
SetThreadingLayer wraps cudssSetThreadingLayer.
type HostPtr ¶
type HostPtr uintptr
HostPtr is the address of host memory referenced by a matrix. Keep the memory valid until the matrix is closed and its stream work completes. Go memory must be pinned with runtime.Pinner for that entire interval. The zero value is a null address.
Example ¶
package main
import (
"fmt"
"github.com/tmc/lib/nvidia/cudss"
)
func main() {
var p cudss.HostPtr
fmt.Println(p == 0)
}
Output: true
type LibraryAttempt ¶
LibraryAttempt records one failed attempt to open the shared library.
type LibraryConflictError ¶
type LibraryConflictError struct {
Loaded string
Requested string
// Implicit reports that the loaded library was opened lazily and no
// successful Load has since acknowledged it. A
// caller that sees this called some
// other function first, and that call took the default search list.
Implicit bool
}
LibraryConflictError reports a Load call naming a different library than the one already loaded. Only one library is loaded per process.
func (*LibraryConflictError) Error ¶
func (e *LibraryConflictError) Error() string
Error reports the conflicting library paths, and whether the library that is already loaded got there without a Load call.
type LibraryError ¶
type LibraryError struct {
Library string
Env string
Path string
Attempts []LibraryAttempt
Hint string
}
LibraryError reports that libcudss could not be opened. Attempts lists every name tried in order. Path is set when an explicit path, from Load or CUDSS_LIB_PATH, was requested and failed. Hint reports pkg-config discovery results and query failures, when discovery ran.
func (*LibraryError) Error ¶
func (e *LibraryError) Error() string
Error describes the library load attempts and their errors.
func (*LibraryError) Unwrap ¶
func (e *LibraryError) Unwrap() []error
Unwrap returns the error from each attempt.
type LibraryPropertyType ¶
type LibraryPropertyType int32
LibraryPropertyType identifies a library property to query.
const ( MajorVersion LibraryPropertyType = 0 MinorVersion LibraryPropertyType = 1 PatchLevel LibraryPropertyType = 2 )
LibraryPropertyType constants.
type LogFunc ¶
A LogFunc receives one cuDSS log record. level is the vendor's log level, function is the cuDSS entry point that produced the record, and message is the text.
LogFunc is called from a thread owned by libcudss, possibly while another goroutine is inside an unrelated cuDSS call. It must not call back into this package, and it must not block: the library thread is stopped for its duration.
type MatchingAlg ¶
type MatchingAlg int32
MatchingAlg represents cudssMatchingAlg_t.
const ( MatchingAlgNone MatchingAlg = 0 // / Matching is disabled MatchingAlgMaxDiagCount MatchingAlg = 1 MatchingAlgMaxMinDiag MatchingAlg = 2 MatchingAlgMaxMinDiagAlt MatchingAlg = 3 MatchingAlgMaxDiagSum MatchingAlg = 4 MatchingAlgMaxDiagProduct MatchingAlg = 5 MatchingAlgAuto MatchingAlg = 6 // / The library selects the alg to apply )
func (MatchingAlg) String ¶
func (e MatchingAlg) String() string
String returns the constant name, or a numeric representation for unknown values.
type Matrix ¶
type Matrix uintptr
Matrix is an opaque handle for cudssMatrix_t.
func MatrixCreateBatchCsr ¶
func MatrixCreateBatchCsr(batchCount int64, nrows HostPtr, ncols HostPtr, nnz HostPtr, rowStart driver.DevicePtr, rowEnd driver.DevicePtr, colIndices driver.DevicePtr, values driver.DevicePtr, offsetType DataType, indexType DataType, valueType DataType, mtype MatrixType, mview MatrixViewType, indexBase IndexBase) (Matrix, error)
MatrixCreateBatchCsr creates a batch of CSR matrices.
The rowStart, rowEnd, colIndices, and values arguments are device addresses of arrays whose elements are device pointers. Keep the arrays and their data valid until the matrix is closed and its stream work completes. See https://docs.nvidia.com/cuda/cudss/functions.html#cudssmatrixcreatebatchcsr.
Wraps cudssMatrixCreateBatchCsr.
func MatrixCreateBatchDn ¶
func MatrixCreateBatchDn(batchCount int64, nrows HostPtr, ncols HostPtr, ld HostPtr, values driver.DevicePtr, integerType DataType, valueType DataType, layout Layout) (Matrix, error)
MatrixCreateBatchDn creates a batch of dense matrices.
The values arguments are device addresses of arrays whose elements are device pointers. Keep the arrays and their data valid until the matrix is closed and its stream work completes. See https://docs.nvidia.com/cuda/cudss/functions.html#cudssmatrixcreatebatchdn.
Wraps cudssMatrixCreateBatchDn.
func MatrixCreateCsr ¶
func MatrixCreateCsr(nrows int64, ncols int64, nnz int64, rowStart uintptr, rowEnd uintptr, colIndices uintptr, values uintptr, offsetType DataType, indexType DataType, valueType DataType, mtype MatrixType, mview MatrixViewType, indexBase IndexBase) (Matrix, error)
MatrixCreateCsr wraps cudssMatrixCreateCsr.
func MatrixCreateDn ¶
func MatrixCreateDn(nrows int64, ncols int64, ld int64, values uintptr, valueType DataType, layout Layout) (Matrix, error)
MatrixCreateDn wraps cudssMatrixCreateDn.
func NewMatrixBatchCsr ¶
func NewMatrixBatchCsr(batchCount int64, nrows HostPtr, ncols HostPtr, nnz HostPtr, rowStart driver.DevicePtr, rowEnd driver.DevicePtr, colIndices driver.DevicePtr, values driver.DevicePtr, offsetType DataType, indexType DataType, valueType DataType, mtype MatrixType, mview MatrixViewType, indexBase IndexBase) (Matrix, error)
NewMatrixBatchCsr creates a batch of CSR matrices.
The rowStart, rowEnd, colIndices, and values arguments are device addresses of arrays whose elements are device pointers. Keep the arrays and their data valid until the matrix is closed and its stream work completes. See https://docs.nvidia.com/cuda/cudss/functions.html#cudssmatrixcreatebatchcsr.
Wraps cudssMatrixCreateBatchCsr.
func NewMatrixBatchDn ¶
func NewMatrixBatchDn(batchCount int64, nrows HostPtr, ncols HostPtr, ld HostPtr, values driver.DevicePtr, integerType DataType, valueType DataType, layout Layout) (Matrix, error)
NewMatrixBatchDn creates a batch of dense matrices.
The values arguments are device addresses of arrays whose elements are device pointers. Keep the arrays and their data valid until the matrix is closed and its stream work completes. See https://docs.nvidia.com/cuda/cudss/functions.html#cudssmatrixcreatebatchdn.
Wraps cudssMatrixCreateBatchDn.
func NewMatrixCsr ¶
func NewMatrixCsr(nrows int64, ncols int64, nnz int64, rowStart uintptr, rowEnd uintptr, colIndices uintptr, values uintptr, offsetType DataType, indexType DataType, valueType DataType, mtype MatrixType, mview MatrixViewType, indexBase IndexBase) (Matrix, error)
NewMatrixCsr wraps cudssMatrixCreateCsr.
func NewMatrixDn ¶
func NewMatrixDn(nrows int64, ncols int64, ld int64, values uintptr, valueType DataType, layout Layout) (Matrix, error)
NewMatrixDn wraps cudssMatrixCreateDn.
func (Matrix) BatchCsr ¶
func (m Matrix) BatchCsr(batchCount *int64, nrows *HostPtr, ncols *HostPtr, nnz *HostPtr, rowStart *driver.DevicePtr, rowEnd *driver.DevicePtr, colIndices *driver.DevicePtr, values *driver.DevicePtr, offsetType *DataType, indexType *DataType, valueType *DataType, mtype *MatrixType, mview *MatrixViewType, indexBase *IndexBase) error
BatchCsr retrieves a batch of CSR matrices.
The rowStart, rowEnd, colIndices, and values output slots receive addresses of device arrays whose elements are device pointers. See https://docs.nvidia.com/cuda/cudss/functions.html#cudssmatrixgetbatchcsr.
Wraps cudssMatrixGetBatchCsr.
func (Matrix) BatchDn ¶
func (m Matrix) BatchDn(batchCount *int64, nrows *HostPtr, ncols *HostPtr, ld *HostPtr, values *driver.DevicePtr, indexType *DataType, valueType *DataType, layout *Layout) error
BatchDn retrieves a batch of dense matrices.
The values output slots receive addresses of device arrays whose elements are device pointers. See https://docs.nvidia.com/cuda/cudss/functions.html#cudssmatrixgetbatchdn.
Wraps cudssMatrixGetBatchDn.
func (*Matrix) Close ¶
Close wraps cudssMatrixDestroy.
If m is zero, Close returns nil. Otherwise Close sets m to zero when the call succeeds and leaves it unchanged when it fails. Only m is zeroed: a copy of it still refers to the released object.
func (Matrix) Csr ¶
func (m Matrix) Csr(nrows *int64, ncols *int64, nnz *int64, rowStart *uintptr, rowEnd *uintptr, colIndices *uintptr, values *uintptr, offsetType *DataType, indexType *DataType, valueType *DataType, mtype *MatrixType, mview *MatrixViewType, indexBase *IndexBase) error
Csr wraps cudssMatrixGetCsr.
func (Matrix) DistributionRow1d ¶
DistributionRow1d wraps cudssMatrixGetDistributionRow1d.
func (Matrix) Dn ¶
func (m Matrix) Dn(nrows *int64, ncols *int64, ld *int64, values *uintptr, type_ *DataType, layout *Layout) error
Dn wraps cudssMatrixGetDn.
func (Matrix) SetBatchCsrPointers ¶
func (m Matrix) SetBatchCsrPointers(rowOffsets driver.DevicePtr, rowEnd driver.DevicePtr, colIndices driver.DevicePtr, values driver.DevicePtr) error
SetBatchCsrPointers sets the CSR arrays of a batch.
The rowOffsets, rowEnd, colIndices, and values arguments are device addresses of arrays whose elements are device pointers. Keep the arrays and their data valid until the matrix is closed and its stream work completes. See https://docs.nvidia.com/cuda/cudss/functions.html#cudssmatrixsetbatchcsrpointers.
Wraps cudssMatrixSetBatchCsrPointers.
func (Matrix) SetBatchValues ¶
SetBatchValues sets the values arrays of a batch.
The values arguments are device addresses of arrays whose elements are device pointers. Keep the arrays and their data valid until the matrix is closed and its stream work completes. See https://docs.nvidia.com/cuda/cudss/functions.html#cudssmatrixsetbatchvalues.
Wraps cudssMatrixSetBatchValues.
func (Matrix) SetCsrPointers ¶
func (m Matrix) SetCsrPointers(rowOffsets uintptr, rowEnd uintptr, colIndices uintptr, values uintptr) error
SetCsrPointers wraps cudssMatrixSetCsrPointers.
func (Matrix) SetDistributionRow1d ¶
SetDistributionRow1d wraps cudssMatrixSetDistributionRow1d.
type MatrixFormat ¶
type MatrixFormat int32
MatrixFormat represents cudssMatrixFormat_t.
const ( MformatDense MatrixFormat = 1 MformatCsr MatrixFormat = 2 MformatBatch MatrixFormat = 4 MformatDistributed MatrixFormat = 8 )
func (MatrixFormat) String ¶
func (e MatrixFormat) String() string
String returns the constant name, or a numeric representation for unknown values.
type MatrixType ¶
type MatrixType int32
MatrixType represents cudssMatrixType_t.
const ( MtypeGeneral MatrixType = 0 MtypeSymmetric MatrixType = 1 MtypeHermitian MatrixType = 2 MtypeSpd MatrixType = 3 MtypeHpd MatrixType = 4 )
func (MatrixType) String ¶
func (e MatrixType) String() string
String returns the constant name, or a numeric representation for unknown values.
type MatrixViewType ¶
type MatrixViewType int32
MatrixViewType represents cudssMatrixViewType_t.
const ( MviewFull MatrixViewType = 0 MviewLower MatrixViewType = 1 MviewUpper MatrixViewType = 2 )
func (MatrixViewType) String ¶
func (e MatrixViewType) String() string
String returns the constant name, or a numeric representation for unknown values.
type ParamElement ¶
ParamElement is the set of element types a cuDSS array parameter can have.
Which one a given parameter needs is not free: an index-typed parameter takes the index type the system matrix was created with, and a value-typed parameter takes its value type. Reading a parameter with the wrong element type is not caught by the library, so DataArray checks the number of bytes written and reports *ParamSizeError when it is not a whole number of elements of the requested type.
type ParamSizeError ¶
A ParamSizeError reports that the library wrote a number of bytes other than the size of the storage it was given. It means the caller's Go type and the library's idea of the parameter no longer agree, which is a mismatch between this package and the installed libcudss, not a caller error.
func (*ParamSizeError) Error ¶
func (e *ParamSizeError) Error() string
Error reports the parameter and the two sizes.
type Phase ¶
type Phase int32
Phase represents cudssPhase_t.
const ( PhaseReordering Phase = 1 << 0 PhaseSymbolicFactorization Phase = 1 << 1 PhaseAnalysis Phase = PhaseReordering | PhaseSymbolicFactorization PhaseFactorization Phase = 1 << 2 PhaseRefactorization Phase = 1 << 3 PhaseSolveFwdPerm Phase = 1 << 4 PhaseSolveFwd Phase = 1 << 5 PhaseSolveDiag Phase = 1 << 6 PhaseSolveBwd Phase = 1 << 7 PhaseSolveBwdPerm Phase = 1 << 8 PhaseSolveRefinement Phase = 1 << 9 PhaseSolve Phase = PhaseSolveFwdPerm | PhaseSolveFwd | PhaseSolveDiag | PhaseSolveBwd | PhaseSolveBwdPerm | PhaseSolveRefinement )
type PivotEpsilonAlg ¶
type PivotEpsilonAlg int32
PivotEpsilonAlg represents cudssPivotEpsilonAlg_t.
const ( PivotEpsilonAlgDefault PivotEpsilonAlg = 0 PivotEpsilonAlgScaled PivotEpsilonAlg = 1 PivotEpsilonAlgStatic PivotEpsilonAlg = 2 )
func (PivotEpsilonAlg) String ¶
func (e PivotEpsilonAlg) String() string
String returns the constant name, or a numeric representation for unknown values.
type PivotType ¶
type PivotType int32
PivotType represents cudssPivotType_t.
const ( PivotAuto PivotType = 0 // Automatic pivoting strategy [default] (resolves based on algorithm and matrix type) PivotNone PivotType = 1 // Disable pivoting search (valid for all algorithms) PivotGlobalCol PivotType = 2 // For [ReorderingAlgBtfColamd] and [ReorderingAlgColamd] - all matrix types PivotGlobalRow PivotType = 3 // For [ReorderingAlgBtfColamd] and [ReorderingAlgColamd] - all matrix types PivotDiagonal PivotType = 4 // For symmetric indefinite matrices, [ReorderingAlgAmd] and [ReorderingAlgNestedDissection] PivotLocalBlock PivotType = 5 // For general matrices, [ReorderingAlgAmd] and [ReorderingAlgNestedDissection] PivotBunchKaufman PivotType = 6 // Reserved for future (not supported yet) )
type ReorderingAlg ¶
type ReorderingAlg int32
ReorderingAlg represents cudssReorderingAlg_t.
const ( ReorderingAlgDefault ReorderingAlg = 0 ReorderingAlgBtfColamd ReorderingAlg = 1 ReorderingAlgColamd ReorderingAlg = 2 ReorderingAlgAmd ReorderingAlg = 3 ReorderingAlgNestedDissection ReorderingAlg = 4 ReorderingAlgNone ReorderingAlg = 5 // Uses natural (identity) order for the internal ordering when no user permutation is supplied. )
func (ReorderingAlg) String ¶
func (e ReorderingAlg) String() string
String returns the constant name, or a numeric representation for unknown values.
type Result ¶
type Result int32
Result represents a cudss API error code (cudssStatus_t).
const ( Success Result = 0 ErrNotInitialized Result = 1 ErrAllocFailed Result = 2 ErrInvalidValue Result = 3 ErrNotSupported Result = 4 ErrExecutionFailed Result = 5 ErrInternalError Result = 6 ErrIrFailed Result = 7 )
cudss error codes from cudss.h.
type SymbolError ¶
SymbolError reports that a symbol is not callable.
Err distinguishes the two ways that happens. A nil Err means the loaded library does not export the symbol, which is what an installation older than the symbol looks like. A non-nil Err means the library does export it and the binding itself failed; the library is not at fault.
func (*SymbolError) Error ¶
func (e *SymbolError) Error() string
Error reports the uncallable library symbol and, when the symbol was present but could not be bound, why.
func (*SymbolError) Unwrap ¶
func (e *SymbolError) Unwrap() error
Unwrap returns the reason the symbol could not be bound, or nil when the loaded library does not export it.
type ThreadingInterface ¶
type ThreadingInterface struct {
CudssGetMaxThreads uintptr
CudssParallelFor uintptr
CudssThreadingGetProperty uintptr
}
ThreadingInterface represents interface to threading layer.