Documentation
¶
Index ¶
- func GetDeviceCount() int32
- func GetGlobalGPUUtilization() (float32, error)
- func IsGPUComputeError(err error) bool
- func IsGPUError(err error) bool
- func IsGPUInitializationError(err error) bool
- func IsGPUMemoryError(err error) bool
- func IsGPUNotAvailableError(err error) bool
- func IsGPUSyncError(err error) bool
- func IsRetriableGPUError(err error) bool
- type GPUBackend
- type GPUComputeError
- type GPUConfig
- type GPUInfo
- type GPUInitializationError
- type GPUMemoryError
- type GPUNotAvailableError
- type GPUSyncError
- type Index
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDeviceCount ¶
func GetDeviceCount() int32
func GetGlobalGPUUtilization ¶
func IsGPUComputeError ¶
IsGPUComputeError checks if an error is GPUComputeError
func IsGPUError ¶
IsGPUError checks if an error is any type of GPU error
func IsGPUInitializationError ¶
IsGPUInitializationError checks if an error is GPUInitializationError
func IsGPUMemoryError ¶
IsGPUMemoryError checks if an error is GPUMemoryError
func IsGPUNotAvailableError ¶
IsGPUNotAvailableError checks if an error is GPUNotAvailableError
func IsGPUSyncError ¶
IsGPUSyncError checks if an error is GPUSyncError
func IsRetriableGPUError ¶
IsRetriableGPUError determines if a GPU error is retriable
Types ¶
type GPUBackend ¶
type GPUBackend int
const ( BackendCPU GPUBackend = iota BackendCUDA BackendMetal BackendOpenCL BackendTPU )
func DetectGPUBackend ¶
func DetectGPUBackend() GPUBackend
func (GPUBackend) String ¶
func (b GPUBackend) String() string
type GPUComputeError ¶
GPUComputeError indicates failure during GPU computation
func (*GPUComputeError) Error ¶
func (e *GPUComputeError) Error() string
func (*GPUComputeError) Unwrap ¶
func (e *GPUComputeError) Unwrap() error
Unwrap returns the underlying cause
type GPUConfig ¶
type GPUConfig struct {
Backend GPUBackend
DeviceID int32
Dimension int
Enabled bool
CUDAHome string
FAISSHome string
MetalUnifiedMemory bool
SyncBatchSize int
SyncInterval time.Duration
MaxMemory int64
VendorID string // e.g., "nvidia", "amd", "intel", "apple"
DriverVersion string // GPU driver version
OpenCLVersion string // OpenCL platform version
}
func DefaultGPUConfig ¶
func DefaultGPUConfig() GPUConfig
type GPUInfo ¶
type GPUInfo struct {
Name string
Backend GPUBackend
DeviceID int32
MemoryMB int64
ComputeMajor int
ComputeMinor int
Vendor string // e.g., "NVIDIA", "AMD", "Intel", "Apple"
VendorID string // hex vendor ID (e.g., "0x10de" for NVIDIA)
DriverVersion string // driver version string
OpenCLVersion string // OpenCL device version
Profile string // OpenCL profile (FULL_PROFILE or EMBEDDED_PROFILE)
MaxComputeUnits int // max parallel compute units
MaxWorkGroupSize int64 // max work group size
MaxWorkItemDims []int // max work item dimensions
}
type GPUInitializationError ¶
type GPUInitializationError struct {
DeviceID int32
Backend GPUBackend
Cause error
}
GPUInitializationError indicates failure during GPU initialization
func (*GPUInitializationError) Error ¶
func (e *GPUInitializationError) Error() string
func (*GPUInitializationError) Unwrap ¶
func (e *GPUInitializationError) Unwrap() error
Unwrap returns the underlying cause
type GPUMemoryError ¶
GPUMemoryError indicates GPU memory allocation failure
func (*GPUMemoryError) Error ¶
func (e *GPUMemoryError) Error() string
type GPUNotAvailableError ¶
type GPUNotAvailableError struct {
Reason string
}
GPUNotAvailableError indicates that GPU is not available on this system
func (*GPUNotAvailableError) Error ¶
func (e *GPUNotAvailableError) Error() string
type GPUSyncError ¶
GPUSyncError indicates failure during GPU synchronization
func (*GPUSyncError) Error ¶
func (e *GPUSyncError) Error() string
func (*GPUSyncError) Unwrap ¶
func (e *GPUSyncError) Unwrap() error
Unwrap returns the underlying cause
type Index ¶
type Index interface {
Add(ids []int64, vectors []float32) error
Search(vector []float32, k int) (ids []int64, distances []float32, err error)
SearchBatch(vectors [][]float32, k int) (ids [][]int64, distances [][]float32, err error)
SearchBatchDistances(query []float32, candidateIDs []uint32) ([]float32, error)
// PQ methods
AddPQ(ids []int64, codes []byte, m int) error
SearchPQ(lookupTable []float32, m int, k int) (ids []int64, distances []float32, err error)
TrainPQ(vectors []float32, m int, k int) error
EncodePQ(vectors []float32) ([]byte, error)
AssignToClusters(vectors []float32, centroids []float32) ([]uint32, error)
// Typed search methods for different vector types
SearchFloat16(vector []uint16, k int) (ids []int64, distances []float32, err error)
SearchComplex64(vector []uint16, k int) (ids []int64, distances []float32, err error)
SearchComplex128(vector []float32, k int) (ids []int64, distances []float32, err error)
// Integer vector search types
SearchInt8(vector []int8, k int) (ids []int64, distances []float32, err error)
SearchUint8(vector []uint8, k int) (ids []int64, distances []float32, err error)
SearchInt16(vector []int16, k int) (ids []int64, distances []float32, err error)
SearchUint16(vector []uint16, k int) (ids []int64, distances []float32, err error)
AddTurboQuant(ids []int64, tqData []byte, bitsPerAngle int) error
SearchTurboQuant(vector []float32, k int, bitsPerAngle int) (ids []int64, distances []float32, err error)
// Graph methods
UpdateGraph(offsets []uint32, neighbors []uint32, weights []float32) error
GraphExpand(seeds []uint32, depth int, alpha float32) (ids []uint32, scores []float32, err error)
PruneNeighbors(candidateIds []uint32, candidateDists []float32, maxNeighbors int, allVectors []float32) ([]uint32, error)
SearchGreedy(query []float32, entryPoint uint32, entryDist float32) (uint32, float32, error)
// Spatial and Temporal Acceleration
HaversineSearch(centerLat, centerLon float32, points []float32, earthRadius float32) ([]float32, error)
NormBatch(vectors []float32, dims int) ([]float32, error)
// Lifecycle and Metadata
Close() error
Sync() error
Clear() error
Reset() error
Backend() GPUBackend
DeviceID() int32
GetDeviceInfo() (*GPUInfo, error)
GetMemoryInfo() (total, free, used int64, err error)
GetUtilization() (float32, error)
}