cudss

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: Apache-2.0 Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

Phases

Device memory

Logging

Matrix objects

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)
}

Index

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

func ConfigDestroy(solverConfig Config) error

ConfigDestroy wraps cudssConfigDestroy.

func DataArray

func DataArray[T ParamElement](handle Handle, data Data, param DataParam, dst []T) (int, error)

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

func DataDestroy(handle Handle, solverData Data) error

DataDestroy wraps cudssDataDestroy.

func Destroy

func Destroy(handle Handle) error

Destroy wraps cudssDestroy.

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

func Has(symbol string) bool

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

func Load(path string) error

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

func LoggerOpenFile(logFile string) error

LoggerOpenFile wraps cudssLoggerOpenFile.

func LoggerSetCallback

func LoggerSetCallback(callback uintptr) error

LoggerSetCallback wraps cudssLoggerSetCallback.

func LoggerSetLevel

func LoggerSetLevel(level int32) error

LoggerSetLevel wraps cudssLoggerSetLevel.

func LoggerSetMask

func LoggerSetMask(mask int32) error

LoggerSetMask wraps cudssLoggerSetMask.

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

func MatrixDestroy(matrix Matrix) error

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

func MatrixGetDistributionRow1d(matrix Matrix, firstRow *int64, lastRow *int64) error

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

func MatrixGetFormat(matrix Matrix) (int32, error)

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

func MatrixSetBatchValues(matrix Matrix, values driver.DevicePtr) error

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

func MatrixSetDistributionRow1d(matrix Matrix, firstRow int64, lastRow int64) error

MatrixSetDistributionRow1d wraps cudssMatrixSetDistributionRow1d.

func MatrixSetValues

func MatrixSetValues(matrix Matrix, values uintptr) error

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

func SetCommLayer(handle Handle, commLibFileName string) error

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

func SetDataArrayAt(handle Handle, data Data, param DataParam, addr uintptr, size uintptr) error

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

func SetLogFunc(fn LogFunc) error

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

func SetMgStreams(handle Handle, streams *driver.Stream, streamCount int32) error

SetMgStreams wraps cudssSetMgStreams.

func SetStream

func SetStream(handle Handle, stream driver.Stream) error

SetStream wraps cudssSetStream.

func SetThreadingLayer

func SetThreadingLayer(handle Handle, thrLibFileName string) error

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

type BindFailure struct {
	Symbol string
	Err    error
}

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

type CallError struct {
	Func   string // the C symbol called
	Result Result
}

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.

func (*CallError) Error

func (e *CallError) Error() string

Error reports the C symbol called and the result it returned.

func (*CallError) Unwrap

func (e *CallError) Unwrap() error

Unwrap returns the result the call reported.

type Config

type Config uintptr

Config is an opaque handle for cudssConfig_t.

func ConfigCreate

func ConfigCreate() (Config, error)

ConfigCreate wraps cudssConfigCreate.

func NewConfig

func NewConfig() (Config, error)

NewConfig wraps cudssConfigCreate.

func (*Config) Close

func (c *Config) Close() error

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

func (c Config) DeterministicMode() (int32, error)

DeterministicMode reports whether the factorization is bitwise reproducible; 0 disables, the default.

It reads int32 (int) from CUDSS_CONFIG_DETERMINISTIC_MODE.

func (Config) DeviceCount

func (c Config) DeviceCount() (int32, error)

DeviceCount reports the number of devices for multi-GPU execution.

It reads int32 (int) from CUDSS_CONFIG_DEVICE_COUNT.

func (Config) DeviceIndices

func (c Config) DeviceIndices(dst []int32) (int, error)

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

func (c Config) HostThreads() (int32, error)

HostThreads reports the number of host threads the threading layer may use.

It reads int32 (int) from CUDSS_CONFIG_HOST_NTHREADS.

func (Config) HybridDeviceMemoryLimit

func (c Config) HybridDeviceMemoryLimit() (int64, error)

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

func (c Config) HybridExecuteMode() (int32, error)

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

func (c Config) HybridMemoryMode() (int32, error)

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

func (c Config) IRSteps() (int32, error)

IRSteps reports the maximum number of iterative refinement steps.

It reads int32 (int) from CUDSS_CONFIG_IR_N_STEPS.

func (Config) IRTolerance

func (c Config) IRTolerance() (float64, error)

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

func (c Config) MaxLUNonzeros() (int64, error)

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

func (c Config) NestedDissectionLevels() (int32, error)

NestedDissectionLevels reports the number of levels for nested dissection reordering.

It reads int32 (int) from CUDSS_CONFIG_ND_NLEVELS.

func (Config) NestedDissectionUnbalanceFactor

func (c Config) NestedDissectionUnbalanceFactor() (int32, error)

NestedDissectionUnbalanceFactor reports the nested dissection unbalance factor, in percent.

It reads int32 (int) from CUDSS_CONFIG_ND_UBFACTOR.

func (Config) PivotEpsilon

func (c Config) PivotEpsilon() (float64, error)

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

func (c Config) PivotThreshold() (float64, error)

PivotThreshold reports the pivoting threshold.

It reads float64 (double) from CUDSS_CONFIG_PIVOT_THRESHOLD.

func (Config) PivotType

func (c Config) PivotType() (PivotType, error)

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

func (c Config) SchurMode() (int32, error)

SchurMode reports whether the Schur complement is computed; 0 disables, the default.

It reads int32 (int) from CUDSS_CONFIG_SCHUR_MODE.

func (Config) SetDeterministicMode

func (c Config) SetDeterministicMode(v int32) error

SetDeterministicMode sets whether the factorization is bitwise reproducible; 0 disables, the default.

It writes int32 (int) to CUDSS_CONFIG_DETERMINISTIC_MODE.

func (Config) SetDeviceCount

func (c Config) SetDeviceCount(v int32) error

SetDeviceCount sets the number of devices for multi-GPU execution.

It writes int32 (int) to CUDSS_CONFIG_DEVICE_COUNT.

func (Config) SetDeviceIndices

func (c Config) SetDeviceIndices(v []int32) error

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

func (c Config) SetHostThreads(v int32) error

SetHostThreads sets the number of host threads the threading layer may use.

It writes int32 (int) to CUDSS_CONFIG_HOST_NTHREADS.

func (Config) SetHybridDeviceMemoryLimit

func (c Config) SetHybridDeviceMemoryLimit(v int64) error

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

func (c Config) SetHybridExecuteMode(v int32) error

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

func (c Config) SetHybridMemoryMode(v int32) error

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

func (c Config) SetIRSteps(v int32) error

SetIRSteps sets the maximum number of iterative refinement steps.

It writes int32 (int) to CUDSS_CONFIG_IR_N_STEPS.

func (Config) SetIRTolerance

func (c Config) SetIRTolerance(v float64) error

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

func (c Config) SetMaxLUNonzeros(v int64) error

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

func (c Config) SetNestedDissectionLevels(v int32) error

SetNestedDissectionLevels sets the number of levels for nested dissection reordering.

It writes int32 (int) to CUDSS_CONFIG_ND_NLEVELS.

func (Config) SetNestedDissectionUnbalanceFactor

func (c Config) SetNestedDissectionUnbalanceFactor(v int32) error

SetNestedDissectionUnbalanceFactor sets the nested dissection unbalance factor, in percent.

It writes int32 (int) to CUDSS_CONFIG_ND_UBFACTOR.

func (Config) SetPivotEpsilon

func (c Config) SetPivotEpsilon(v float64) error

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

func (c Config) SetPivotThreshold(v float64) error

SetPivotThreshold sets the pivoting threshold.

It writes float64 (double) to CUDSS_CONFIG_PIVOT_THRESHOLD.

func (Config) SetPivotType

func (c Config) SetPivotType(v PivotType) error

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

func (c Config) SetSchurMode(v int32) error

SetSchurMode sets whether the Schur complement is computed; 0 disables, the default.

It writes int32 (int) to CUDSS_CONFIG_SCHUR_MODE.

func (Config) SetSolveAlg

func (c Config) SetSolveAlg(v SolveAlg) error

SetSolveAlg sets the solve algorithm.

It writes SolveAlg (cudssSolveAlg_t) to CUDSS_CONFIG_SOLVE_ALG.

func (Config) SetSolveMode

func (c Config) SetSolveMode(v int32) error

SetSolveMode sets the solve mode for transpose and conjugate-transpose solves.

It writes int32 (int) to CUDSS_CONFIG_SOLVE_MODE.

func (Config) SetUniformBatchIndex

func (c Config) SetUniformBatchIndex(v int32) error

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

func (c Config) SetUniformBatchSize(v int32) error

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

func (c Config) SetUseCUDARegisterMemory(v int32) error

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

func (c Config) SetUseSuperpanels(v int32) error

SetUseSuperpanels sets whether superpanels are used; enabled by default.

It writes int32 (int) to CUDSS_CONFIG_USE_SUPERPANELS.

func (Config) SolveAlg

func (c Config) SolveAlg() (SolveAlg, error)

SolveAlg reports the solve algorithm.

It reads SolveAlg (cudssSolveAlg_t) from CUDSS_CONFIG_SOLVE_ALG.

func (Config) SolveMode

func (c Config) SolveMode() (int32, error)

SolveMode reports the solve mode for transpose and conjugate-transpose solves.

It reads int32 (int) from CUDSS_CONFIG_SOLVE_MODE.

func (Config) UniformBatchIndex

func (c Config) UniformBatchIndex() (int32, error)

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

func (c Config) UniformBatchSize() (int32, error)

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

func (c Config) UseCUDARegisterMemory() (int32, error)

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

func (c Config) UseSuperpanels() (int32, error)

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

type CudssFp64mp2 struct {
	Hi float64
	Lo float64
}

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 DataCreate

func DataCreate(handle Handle) (Data, error)

DataCreate wraps cudssDataCreate.

func NewData

func NewData(handle Handle) (Data, error)

NewData wraps cudssDataCreate.

func (Data) Destroy

func (d Data) Destroy(handle Handle) error

Destroy wraps cudssDataDestroy.

It is not named Close because it takes more than the handle.

func (Data) Flops

func (d Data) Flops(handle Handle) (int64, error)

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

func (d Data) HybridDeviceMemoryMin(handle Handle) (int64, error)

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

func (d Data) IRSteps(handle Handle) (int32, error)

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

func (d Data) Info(handle Handle) (int32, error)

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

func (d Data) LUNonzeros(handle Handle) (int64, error)

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

func (d Data) MemoryEstimates(handle Handle) ([16]int64, error)

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

func (d Data) SchurShape(handle Handle) ([3]int64, error)

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

func (d Data) SetSchurMatrix(handle Handle, v Matrix) error

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

func (d Data) SetUniformBatchMask(handle Handle, src []int64) error

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

func (d Data) SetUserHostInterrupt(handle Handle, addr uintptr) error

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

func (d Data) UniformBatchMask(handle Handle, dst []int64) (int, error)

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)
)

func (DataParam) ParamType

func (e DataParam) ParamType() string

ParamType returns the C type the cuDSS reference documents for a data parameter, or the empty string for a parameter this package does not model.

func (DataParam) String

func (e DataParam) String() string

String returns the constant name, or a numeric representation for unknown values.

type DataType

type DataType int32

DataType represents cudssDataType_t.

const (
	DataTypeUnset DataType = 1024
	R32F          DataType = 0
	R64F          DataType = 1
	C32F          DataType = 4
	C64F          DataType = 5
	R64F64F       DataType = 1026
	R32I          DataType = 10
	R64I          DataType = 24
)

func (DataType) String

func (e DataType) String() string

String returns the constant name, or a numeric representation for unknown values.

type DeviceMemHandler

type DeviceMemHandler struct {
	Ctx         uintptr
	DeviceAlloc uintptr
	DeviceFree  uintptr
	Name        [64]byte
}

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 Create

func Create() (Handle, error)

Create wraps cudssCreate.

func CreateMg

func CreateMg(deviceCount int32, deviceIndices *int32) (Handle, error)

CreateMg wraps cudssCreateMg.

func NewHandle

func NewHandle() (Handle, error)

NewHandle wraps cudssCreate.

func NewHandleMg

func NewHandleMg(deviceCount int32, deviceIndices *int32) (Handle, error)

NewHandleMg wraps cudssCreateMg.

func (*Handle) Close

func (h *Handle) Close() error

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

func (h Handle) SetCommLayer(commLibFileName string) error

SetCommLayer wraps cudssSetCommLayer.

func (Handle) SetDeviceMemHandler

func (h Handle) SetDeviceMemHandler(handler *DeviceMemHandler) error

SetDeviceMemHandler wraps cudssSetDeviceMemHandler.

func (Handle) SetMgStreams

func (h Handle) SetMgStreams(streams *driver.Stream, streamCount int32) error

SetMgStreams wraps cudssSetMgStreams.

func (Handle) SetStream

func (h Handle) SetStream(stream driver.Stream) error

SetStream wraps cudssSetStream.

func (Handle) SetThreadingLayer

func (h Handle) SetThreadingLayer(thrLibFileName string) error

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 IndexBase

type IndexBase int32

IndexBase represents cudssIndexBase_t.

const (
	BaseZero IndexBase = 0
	BaseOne  IndexBase = 1
)

func (IndexBase) String

func (e IndexBase) String() string

String returns the constant name, or a numeric representation for unknown values.

type Layout

type Layout int32

Layout represents cudssLayout_t.

const (
	LayoutColMajor Layout = 0
	LayoutRowMajor Layout = 1
)

func (Layout) String

func (e Layout) String() string

String returns the constant name, or a numeric representation for unknown values.

type LibraryAttempt

type LibraryAttempt struct {
	Name string // path or soname passed to dlopen
	Err  error
}

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

type LogFunc func(level int, function, message string)

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

func (m *Matrix) Close() error

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

func (m Matrix) DistributionRow1d(firstRow *int64, lastRow *int64) error

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) Format

func (m Matrix) Format() (int32, error)

Format wraps cudssMatrixGetFormat.

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

func (m Matrix) SetBatchValues(values driver.DevicePtr) error

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

func (m Matrix) SetDistributionRow1d(firstRow int64, lastRow int64) error

SetDistributionRow1d wraps cudssMatrixSetDistributionRow1d.

func (Matrix) SetValues

func (m Matrix) SetValues(values uintptr) error

SetValues wraps cudssMatrixSetValues.

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

type ParamElement interface {
	~int32 | ~int64 | ~float32 | ~float64
}

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

type ParamSizeError struct {
	Param string
	Want  uintptr
	Got   uintptr
}

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
)

func (Phase) String

func (e Phase) String() string

String returns the constant name, or a numeric representation for unknown values.

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)
)

func (PivotType) String

func (e PivotType) String() string

String returns the constant name, or a numeric representation for unknown values.

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.

func (Result) Code

func (r Result) Code() int32

Code returns the underlying result code for programmatic error handling.

func (Result) Error

func (r Result) Error() string

Error implements the error interface. It returns the error name and description derived from the header documentation.

func (Result) String

func (r Result) String() string

String returns the Go constant name of the result.

type SolveAlg

type SolveAlg int32

SolveAlg represents cudssSolveAlg_t.

const (
	SolveAlgDefault SolveAlg = 0
	SolveAlgGeneral SolveAlg = 1
)

func (SolveAlg) String

func (e SolveAlg) String() string

String returns the constant name, or a numeric representation for unknown values.

type SymbolError

type SymbolError struct {
	Symbol string
	Err    error
}

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.

Jump to

Keyboard shortcuts

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