Documentation
¶
Index ¶
- Constants
- func CheckBinaryDiagnostic(logger *zerolog.Logger)
- func DetectAvailableDevices() ([]int32, error)
- func GetDeviceCount() int
- func GetGPUFriendlyPtr(data []float32) unsafe.Pointer
- func GetGPUFriendlySlice(data []float32) []byte
- func GetGPURequirements(backend GPUBackend) (bool, string, error)
- func GetGlobalGPUUtilization() (float32, error)
- func IsGPUComputeError(err error) bool
- func IsGPUMemoryError(err error) bool
- func KernelProfilingEnabled() bool
- func ResetKernelProfile()
- func SetKernelProfiling(bool)
- func ValidateBackend(backend GPUBackend) error
- type CPUIndex
- func (i *CPUIndex) Add(ids []int64, vectors []float32) error
- func (i *CPUIndex) AddPQ(ids []int64, codes []byte, m int) error
- func (i *CPUIndex) AddTurboQuant(ids []int64, tqData []byte, bitsPerAngle int) error
- func (i *CPUIndex) AssignToClusters(vectors []float32, centroids []float32) ([]uint32, error)
- func (i *CPUIndex) Backend() GPUBackend
- func (i *CPUIndex) Clear() error
- func (i *CPUIndex) Close() error
- func (i *CPUIndex) DeviceID() int32
- func (i *CPUIndex) EncodePQ(vectors []float32) ([]byte, error)
- func (i *CPUIndex) GetDeviceInfo() (*GPUInfo, error)
- func (i *CPUIndex) GetMemoryInfo() (total, free, used int64, err error)
- func (i *CPUIndex) GetUtilization() (float32, error)
- func (i *CPUIndex) GraphExpand(seeds []uint32, depth int, alpha float32) ([]uint32, []float32, error)
- func (i *CPUIndex) HaversineSearch(centerLat, centerLon float32, points []float32, earthRadius float32) ([]float32, error)
- func (i *CPUIndex) NormBatch(vectors []float32, dims int) ([]float32, error)
- func (i *CPUIndex) PruneNeighbors(candidateIds []uint32, candidateDists []float32, maxNeighbors int, ...) ([]uint32, error)
- func (i *CPUIndex) Reset() error
- func (i *CPUIndex) Search(vector []float32, k int) (ids []int64, distances []float32, err error)
- func (i *CPUIndex) SearchBatch(vectors [][]float32, k int) ([][]int64, [][]float32, error)
- func (i *CPUIndex) SearchBatchDistances(query []float32, candidateIDs []uint32) ([]float32, error)
- func (i *CPUIndex) SearchComplex64(vector []uint16, k int) ([]int64, []float32, error)
- func (i *CPUIndex) SearchComplex128(vector []float32, k int) ([]int64, []float32, error)
- func (i *CPUIndex) SearchFloat16(vector []uint16, k int) ([]int64, []float32, error)
- func (i *CPUIndex) SearchGreedy(query []float32, entryPoint uint32, entryDist float32) (uint32, float32, error)
- func (i *CPUIndex) SearchInt8(vector []int8, k int) ([]int64, []float32, error)
- func (i *CPUIndex) SearchInt16(vector []int16, k int) ([]int64, []float32, error)
- func (i *CPUIndex) SearchPQ(lookupTable []float32, m int, k int) (ids []int64, distances []float32, err error)
- func (i *CPUIndex) SearchTurboQuant(vector []float32, k int, bitsPerAngle int) ([]int64, []float32, error)
- func (i *CPUIndex) SearchUint8(vector []uint8, k int) ([]int64, []float32, error)
- func (i *CPUIndex) SearchUint16(vector []uint16, k int) ([]int64, []float32, error)
- func (i *CPUIndex) Sync() error
- func (i *CPUIndex) TrainPQ(vectors []float32, m int, k int) error
- func (i *CPUIndex) UpdateGraph(offsets []uint32, neighbors []uint32, weights []float32) error
- type CircuitBreaker
- type CircuitBreakerConfig
- type CircuitBreakerStats
- type CircuitState
- type DeviceStats
- type GPUBackend
- type GPUComputeError
- type GPUConfig
- type GPUDevice
- type GPUIndexPool
- func (p *GPUIndexPool) Cleanup() int
- func (p *GPUIndexPool) Close() error
- func (p *GPUIndexPool) GetGPUIndex(config types.GPUConfig) (types.Index, error)
- func (p *GPUIndexPool) ReturnGPUIndex(index types.Index) error
- func (p *GPUIndexPool) Stats() GPUIndexPoolStats
- func (p *GPUIndexPool) UpdateMetrics()
- type GPUIndexPoolConfig
- type GPUIndexPoolStats
- type GPUIndexWrapper
- func (w *GPUIndexWrapper) Add(ids []int64, vectors []float32) error
- func (w *GPUIndexWrapper) Backend() types.GPUBackend
- func (w *GPUIndexWrapper) Close() error
- func (w *GPUIndexWrapper) GetRoutingStats() (cpuQPS int64, gpuQPS int64)
- func (w *GPUIndexWrapper) Search(vector []float32, k int) ([]int64, []float32, error)
- func (w *GPUIndexWrapper) SearchBatchDistances(query []float32, candidateIDs []uint32) ([]float32, error)
- type GPUInfo
- type GPUInitializationError
- type GPUMemPool
- type GPUMemoryError
- type GPUNotAvailableError
- type GPUSyncError
- type Index
- type KernelOpTime
- type KernelProfile
- type MockIndex
- func (m *MockIndex) Add(ids []int64, vectors []float32) error
- func (m *MockIndex) AddPQ(ids []int64, codes []byte, m_val int) error
- func (m *MockIndex) AddTurboQuant(ids []int64, tqData []byte, bitsPerAngle int) error
- func (m *MockIndex) AssignToClusters(vectors []float32, centroids []float32) ([]uint32, error)
- func (m *MockIndex) Backend() GPUBackend
- func (m *MockIndex) Clear() error
- func (m *MockIndex) Close() error
- func (m *MockIndex) DeviceID() int32
- func (m *MockIndex) EncodePQ(vectors []float32) ([]byte, error)
- func (m *MockIndex) GetDeviceInfo() (*GPUInfo, error)
- func (m *MockIndex) GetMemoryInfo() (total, free, used int64, err error)
- func (m *MockIndex) GetUtilization() (float32, error)
- func (m *MockIndex) GraphExpand(seeds []uint32, depth int, alpha float32) ([]uint32, []float32, error)
- func (m *MockIndex) HaversineSearch(centerLat, centerLon float32, points []float32, earthRadius float32) ([]float32, error)
- func (m *MockIndex) NormBatch(vectors []float32, dims int) ([]float32, error)
- func (m *MockIndex) PruneNeighbors(candidateIds []uint32, candidateDists []float32, maxNeighbors int, ...) ([]uint32, error)
- func (m *MockIndex) Reset() error
- func (m *MockIndex) Search(vector []float32, k int) ([]int64, []float32, error)
- func (m *MockIndex) SearchBatch(vectors [][]float32, k int) ([][]int64, [][]float32, error)
- func (m *MockIndex) SearchBatchDistances(query []float32, candidateIDs []uint32) ([]float32, error)
- func (m *MockIndex) SearchComplex64(vector []uint16, k int) ([]int64, []float32, error)
- func (m *MockIndex) SearchComplex128(vector []float32, k int) ([]int64, []float32, error)
- func (m *MockIndex) SearchFloat16(vector []uint16, k int) ([]int64, []float32, error)
- func (m *MockIndex) SearchGreedy(query []float32, entryPoint uint32, entryDist float32) (uint32, float32, error)
- func (m *MockIndex) SearchInt8(vector []int8, k int) ([]int64, []float32, error)
- func (m *MockIndex) SearchInt16(vector []int16, k int) ([]int64, []float32, error)
- func (m *MockIndex) SearchPQ(lookupTable []float32, m_val int, k int) ([]int64, []float32, error)
- func (m *MockIndex) SearchTurboQuant(vector []float32, k int, bitsPerAngle int) ([]int64, []float32, error)
- func (m *MockIndex) SearchUint8(vector []uint8, k int) ([]int64, []float32, error)
- func (m *MockIndex) SearchUint16(vector []uint16, k int) ([]int64, []float32, error)
- func (m *MockIndex) Sync() error
- func (m *MockIndex) TrainPQ(vectors []float32, m_val int, k int) error
- func (m *MockIndex) UpdateGraph(offsets []uint32, neighbors []uint32, weights []float32) error
- type MultiGPUConfig
- type MultiGPUManager
- func (m *MultiGPUManager) AddVectors(ids []int64, vectors []float32) error
- func (m *MultiGPUManager) AddVectorsSharded(ids []int64, vectors []float32) error
- func (m *MultiGPUManager) Close() error
- func (m *MultiGPUManager) DeviceCount() int
- func (m *MultiGPUManager) EncodePQ(vectors []float32) ([]byte, error)
- func (m *MultiGPUManager) GetDevice(deviceID int32) (*GPUDevice, error)
- func (m *MultiGPUManager) GetDeviceByVectorID(id int64) (*GPUDevice, error)
- func (m *MultiGPUManager) GetStats() MultiGPUStats
- func (m *MultiGPUManager) ReplicateToAll(ids []int64, vectors []float32) error
- func (m *MultiGPUManager) Search(query []float32, k int) ([]int64, []float32, error)
- func (m *MultiGPUManager) SearchAllDevices(query []float32, k int) ([][]int64, [][]float32, []error)
- func (m *MultiGPUManager) SearchMerged(query []float32, k int) ([]int64, []float32, error)
- func (m *MultiGPUManager) SearchMergedPQ(lookupTable []float32, mSub int, k int) ([]int64, []float32, error)
- func (m *MultiGPUManager) SearchPQ(lookupTable []float32, mSub int, k int) ([]int64, []float32, error)
- func (m *MultiGPUManager) SelectDevice() *GPUDevice
- func (m *MultiGPUManager) ShardDevice(vectorID int64) *GPUDevice
- func (m *MultiGPUManager) TrainPQ(vectors []float32, mSub, kCentroids int) error
- type MultiGPUStats
- type MultiGPUStrategy
- type TransferRequest
- type ZeroCopyBuffer
- type ZeroCopyManager
- type ZeroCopyPool
Constants ¶
const ( BackendCPU = types.BackendCPU BackendCUDA = types.BackendCUDA BackendMetal = types.BackendMetal BackendOpenCL = types.BackendOpenCL BackendTPU = types.BackendTPU )
Variables ¶
This section is empty.
Functions ¶
func CheckBinaryDiagnostic ¶
CheckBinaryDiagnostic verifies if the binary is built with GPU support. Since this file is built without the 'gpu' tag, it checks hardware and warns if GPU capability is wasted.
func DetectAvailableDevices ¶
func GetDeviceCount ¶
func GetDeviceCount() int
func GetGPUFriendlyPtr ¶
func GetGPUFriendlySlice ¶
func GetGPURequirements ¶
func GetGPURequirements(backend GPUBackend) (bool, string, error)
GetGPURequirements returns the requirements for GPU acceleration based on backend
func GetGlobalGPUUtilization ¶
func IsGPUComputeError ¶
func KernelProfilingEnabled ¶
func KernelProfilingEnabled() bool
KernelProfilingEnabled reports that nothing is being timed.
func ResetKernelProfile ¶
func ResetKernelProfile()
ResetKernelProfile is a no-op without a CUDA backend.
func SetKernelProfiling ¶
func SetKernelProfiling(bool)
SetKernelProfiling is a no-op without a CUDA backend.
func ValidateBackend ¶
func ValidateBackend(backend GPUBackend) error
ValidateBackend validates if the specified backend is available on the current system
Types ¶
type CPUIndex ¶
type CPUIndex struct {
// contains filtered or unexported fields
}
CPUIndex implements a CPU-only fallback index using linear scan
func NewCPUIndex ¶
func (*CPUIndex) AddTurboQuant ¶
func (*CPUIndex) AssignToClusters ¶
func (*CPUIndex) Backend ¶
func (i *CPUIndex) Backend() GPUBackend
func (*CPUIndex) GetDeviceInfo ¶
func (*CPUIndex) GetMemoryInfo ¶
func (*CPUIndex) GetUtilization ¶
func (*CPUIndex) GraphExpand ¶
func (*CPUIndex) HaversineSearch ¶
func (*CPUIndex) PruneNeighbors ¶
func (*CPUIndex) SearchBatch ¶
func (*CPUIndex) SearchBatchDistances ¶
func (*CPUIndex) SearchComplex64 ¶
func (*CPUIndex) SearchComplex128 ¶
func (*CPUIndex) SearchFloat16 ¶
func (*CPUIndex) SearchGreedy ¶
func (*CPUIndex) SearchInt8 ¶
func (*CPUIndex) SearchInt16 ¶
func (*CPUIndex) SearchTurboQuant ¶
func (*CPUIndex) SearchUint8 ¶
func (*CPUIndex) SearchUint16 ¶
type CircuitBreaker ¶
type CircuitBreaker struct {
// contains filtered or unexported fields
}
CircuitBreaker implements the circuit breaker pattern for GPU operations
func NewCircuitBreaker ¶
func NewCircuitBreaker(config CircuitBreakerConfig) *CircuitBreaker
NewCircuitBreaker creates a new circuit breaker
func (*CircuitBreaker) Allow ¶
func (cb *CircuitBreaker) Allow() bool
Allow checks if a request should be allowed through
func (*CircuitBreaker) RecordFailure ¶
func (cb *CircuitBreaker) RecordFailure()
RecordFailure records a failed operation
func (*CircuitBreaker) RecordSuccess ¶
func (cb *CircuitBreaker) RecordSuccess()
RecordSuccess records a successful operation
func (*CircuitBreaker) State ¶
func (cb *CircuitBreaker) State() CircuitState
State returns the current state of the circuit breaker
func (*CircuitBreaker) Stats ¶
func (cb *CircuitBreaker) Stats() CircuitBreakerStats
Stats returns current circuit breaker statistics
type CircuitBreakerConfig ¶
type CircuitBreakerConfig struct {
// FailureThreshold is the number of consecutive failures before opening the circuit
FailureThreshold int
// SuccessThreshold is the number of consecutive successes in half-open state before closing
SuccessThreshold int
// Timeout is the duration the circuit stays open before transitioning to half-open
Timeout time.Duration
}
CircuitBreakerConfig configures the circuit breaker
func DefaultCircuitBreakerConfig ¶
func DefaultCircuitBreakerConfig() CircuitBreakerConfig
DefaultCircuitBreakerConfig returns a default configuration
type CircuitBreakerStats ¶
type CircuitBreakerStats struct {
State string
Failures int
Successes int
LastFailure time.Time
StateDuration time.Duration
}
CircuitBreakerStats holds circuit breaker statistics
func (CircuitBreakerStats) String ¶
func (s CircuitBreakerStats) String() string
String returns a string representation of the stats
type CircuitState ¶
type CircuitState int
CircuitState represents the state of the circuit breaker
const ( // CircuitClosed means the circuit is closed and requests are allowed CircuitClosed CircuitState = iota // CircuitOpen means the circuit is open and requests are blocked CircuitOpen // CircuitHalfOpen means the circuit is testing if the service has recovered CircuitHalfOpen )
func (CircuitState) String ¶
func (s CircuitState) String() string
type DeviceStats ¶
type GPUBackend ¶
type GPUBackend = types.GPUBackend
Re-export basic types from types subpackage for convenience
func DetectGPUBackend ¶
func DetectGPUBackend() GPUBackend
func GetPreferredBackend ¶
func GetPreferredBackend() GPUBackend
GetPreferredBackend returns the best available GPU backend for the current system
type GPUComputeError ¶
type GPUComputeError = types.GPUComputeError
type GPUConfig ¶
func DefaultGPUConfig ¶
func DefaultGPUConfig() GPUConfig
DefaultGPUConfig returns default GPU configuration
type GPUIndexPool ¶
type GPUIndexPool struct {
// contains filtered or unexported fields
}
GPUIndexPool manages a pool of reusable GPU indexes This reduces allocation overhead and enables resource limiting
func NewGPUIndexPool ¶
func NewGPUIndexPool(config GPUIndexPoolConfig) *GPUIndexPool
NewGPUIndexPool creates a new GPU index pool
func (*GPUIndexPool) Cleanup ¶
func (p *GPUIndexPool) Cleanup() int
Cleanup removes expired idle indexes
func (*GPUIndexPool) Close ¶
func (p *GPUIndexPool) Close() error
Close closes the pool and all indexes
func (*GPUIndexPool) GetGPUIndex ¶
GetGPUIndex gets a GPU index from the pool or creates a new one
func (*GPUIndexPool) ReturnGPUIndex ¶
func (p *GPUIndexPool) ReturnGPUIndex(index types.Index) error
ReturnGPUIndex returns a GPU index to the pool
func (*GPUIndexPool) Stats ¶
func (p *GPUIndexPool) Stats() GPUIndexPoolStats
Stats returns pool statistics
func (*GPUIndexPool) UpdateMetrics ¶
func (p *GPUIndexPool) UpdateMetrics()
UpdateMetrics updates Prometheus metrics for the pool
type GPUIndexPoolConfig ¶
GPUIndexPoolConfig configures the GPU index pool
func DefaultGPUIndexPoolConfig ¶
func DefaultGPUIndexPoolConfig() GPUIndexPoolConfig
DefaultGPUIndexPoolConfig returns default pool configuration
type GPUIndexPoolStats ¶
type GPUIndexPoolStats struct {
Idle int
Active int
Waiting int
TotalCreated int
TotalReused int
MaxSize int
MaxConcurrent int
}
GPUIndexPoolStats contains pool statistics
type GPUIndexWrapper ¶
type GPUIndexWrapper struct {
// contains filtered or unexported fields
}
GPUIndexWrapper provides high-scale dynamic routing between CPU index representations and high-throughput GPU index libraries (such as cuVS, Faiss GPU).
func NewGPUIndexWrapper ¶
func NewGPUIndexWrapper(cfg types.GPUConfig, primary Index) (*GPUIndexWrapper, error)
NewGPUIndexWrapper wraps a primary index and instantiates a high-scale GPU index fallback.
func (*GPUIndexWrapper) Add ¶
func (w *GPUIndexWrapper) Add(ids []int64, vectors []float32) error
Add delegates vector ingestion to both primary and high-scale indexes.
func (*GPUIndexWrapper) Backend ¶
func (w *GPUIndexWrapper) Backend() types.GPUBackend
Backend returns the active GPU Backend
func (*GPUIndexWrapper) Close ¶
func (w *GPUIndexWrapper) Close() error
Close closes all underlying indexes and releases VRAM pools.
func (*GPUIndexWrapper) GetRoutingStats ¶
func (w *GPUIndexWrapper) GetRoutingStats() (cpuQPS int64, gpuQPS int64)
GetRoutingStats returns diagnostic routing QPS counters.
func (*GPUIndexWrapper) Search ¶
Search dynamically routes queries to the optimal execution target based on query size and current QPS pressure.
func (*GPUIndexWrapper) SearchBatchDistances ¶
func (w *GPUIndexWrapper) SearchBatchDistances(query []float32, candidateIDs []uint32) ([]float32, error)
SearchBatchDistances offloads batch distances to the GPU index if available.
type GPUInfo ¶
func DetectAvailableGPUs ¶
func DetectAvailableGPUs() []GPUInfo
DetectAvailableGPUs returns information about all available GPU devices
func GetBestGPU ¶
GetBestGPU returns the best available GPU device info
func GetGPUByID ¶
GetGPUByID returns GPU info for a specific device ID
type GPUInitializationError ¶
type GPUInitializationError = types.GPUInitializationError
Error type re-exports
type GPUMemPool ¶
type GPUMemPool = memory.GPUMemPool
Memory management re-exports
func NewGPUMemPool ¶
func NewGPUMemPool(backend GPUBackend, deviceID int32) (*GPUMemPool, error)
type GPUMemoryError ¶
type GPUMemoryError = types.GPUMemoryError
type GPUNotAvailableError ¶
type GPUNotAvailableError = types.GPUNotAvailableError
type GPUSyncError ¶
type GPUSyncError = types.GPUSyncError
type Index ¶
func NewIndex ¶
NewIndex creates a GPU index with auto-detected backend (delegates to implementation)
func NewIndexWithBackend ¶
func NewIndexWithBackend(cfg GPUConfig, backend GPUBackend) (Index, error)
NewIndexWithBackend creates a GPU index with specified backend (delegates to implementation)
func NewIndexWithConfig ¶
NewIndexWithConfig is maintained for backward compatibility (stub)
func NewMetalIndexImpl ¶
NewMetalIndexImpl is maintained for backward compatibility (stub)
func NewMockIndex ¶
func NewMockIndex(cfg GPUConfig, backend GPUBackend) Index
type KernelOpTime ¶
type KernelOpTime struct {
Name string `json:"name"`
Calls int64 `json:"calls"`
TotalMS float64 `json:"total_ms"`
}
KernelOpTime is one named GPU operation's share of the device's time, and KernelProfile the whole table.
type KernelProfile ¶
type KernelProfile struct {
Ops []KernelOpTime `json:"ops"`
TotalMS float64 `json:"total_ms"`
UntimedCalls int64 `json:"untimed_calls"`
PoolExhausted int64 `json:"pool_exhausted"`
// Supported is false when there is no CUDA backend in this build, so a
// report can say "no kernels were measured" instead of "zero milliseconds".
Supported bool `json:"supported"`
}
KernelOpTime is one named GPU operation's share of the device's time, and KernelProfile the whole table.
func CurrentKernelProfile ¶
func CurrentKernelProfile() KernelProfile
CurrentKernelProfile returns an empty, unsupported profile.
func (KernelProfile) AttributedFraction ¶
func (p KernelProfile) AttributedFraction() float64
AttributedFraction is the share of timed GPU time a named kernel accounts for. It is 1 when every op has a name.
func (KernelProfile) Table ¶
func (p KernelProfile) Table() string
Table renders the profile as a fixed-width table.
type MockIndex ¶
type MockIndex struct {
// contains filtered or unexported fields
}
MockIndex implements the Index interface for testing purposes. It uses a simple in-memory map to store vectors and performs linear search.
func (*MockIndex) AddTurboQuant ¶
func (*MockIndex) AssignToClusters ¶
func (*MockIndex) Backend ¶
func (m *MockIndex) Backend() GPUBackend
func (*MockIndex) GetDeviceInfo ¶
func (*MockIndex) GetMemoryInfo ¶
func (*MockIndex) GetUtilization ¶
func (*MockIndex) GraphExpand ¶
func (*MockIndex) HaversineSearch ¶
func (*MockIndex) PruneNeighbors ¶
func (*MockIndex) SearchBatch ¶
func (*MockIndex) SearchBatchDistances ¶
func (*MockIndex) SearchComplex64 ¶
func (*MockIndex) SearchComplex128 ¶
func (*MockIndex) SearchFloat16 ¶
func (*MockIndex) SearchGreedy ¶
func (*MockIndex) SearchInt8 ¶
func (*MockIndex) SearchInt16 ¶
func (*MockIndex) SearchTurboQuant ¶
func (*MockIndex) SearchUint8 ¶
func (*MockIndex) SearchUint16 ¶
type MultiGPUConfig ¶
type MultiGPUConfig struct {
DeviceIDs []int32
Strategy MultiGPUStrategy
MaxMemoryPerGPU int64
EnableMigration bool
BalanceInterval time.Duration
MaxConcurrentGPU int // max concurrent GPU operations across all devices (0 = GOMAXPROCS)
}
func DefaultMultiGPUConfig ¶
func DefaultMultiGPUConfig() MultiGPUConfig
type MultiGPUManager ¶
type MultiGPUManager struct {
// contains filtered or unexported fields
}
func NewMultiGPUManager ¶
func NewMultiGPUManager(config MultiGPUConfig, logger zerolog.Logger) (*MultiGPUManager, error)
func (*MultiGPUManager) AddVectors ¶
func (m *MultiGPUManager) AddVectors(ids []int64, vectors []float32) error
func (*MultiGPUManager) AddVectorsSharded ¶
func (m *MultiGPUManager) AddVectorsSharded(ids []int64, vectors []float32) error
func (*MultiGPUManager) Close ¶
func (m *MultiGPUManager) Close() error
func (*MultiGPUManager) DeviceCount ¶
func (m *MultiGPUManager) DeviceCount() int
func (*MultiGPUManager) EncodePQ ¶
func (m *MultiGPUManager) EncodePQ(vectors []float32) ([]byte, error)
func (*MultiGPUManager) GetDevice ¶
func (m *MultiGPUManager) GetDevice(deviceID int32) (*GPUDevice, error)
func (*MultiGPUManager) GetDeviceByVectorID ¶
func (m *MultiGPUManager) GetDeviceByVectorID(id int64) (*GPUDevice, error)
func (*MultiGPUManager) GetStats ¶
func (m *MultiGPUManager) GetStats() MultiGPUStats
func (*MultiGPUManager) ReplicateToAll ¶
func (m *MultiGPUManager) ReplicateToAll(ids []int64, vectors []float32) error
func (*MultiGPUManager) SearchAllDevices ¶
func (*MultiGPUManager) SearchMerged ¶
func (*MultiGPUManager) SearchMergedPQ ¶
func (*MultiGPUManager) SelectDevice ¶
func (m *MultiGPUManager) SelectDevice() *GPUDevice
func (*MultiGPUManager) ShardDevice ¶
func (m *MultiGPUManager) ShardDevice(vectorID int64) *GPUDevice
type MultiGPUStats ¶
type MultiGPUStats struct {
DeviceCount int
Strategy string
TotalMemory int64
TotalQueries int64
Devices []DeviceStats
}
type MultiGPUStrategy ¶
type MultiGPUStrategy int
const ( StrategyRoundRobin MultiGPUStrategy = iota StrategyLoadBalance StrategyAffinity StrategyMemoryAware )
func (MultiGPUStrategy) String ¶
func (s MultiGPUStrategy) String() string
type TransferRequest ¶
type TransferRequest struct {
Src *ZeroCopyBuffer
Dst *ZeroCopyBuffer
Offset int
Size int
Completed chan error
}
type ZeroCopyBuffer ¶
type ZeroCopyBuffer struct {
// contains filtered or unexported fields
}
func NewPinnedBuffer ¶
func NewPinnedBuffer(size int) (*ZeroCopyBuffer, error)
func NewZeroCopyBuffer ¶
func NewZeroCopyBuffer(size int) (*ZeroCopyBuffer, error)
func (*ZeroCopyBuffer) AddRef ¶
func (b *ZeroCopyBuffer) AddRef()
func (*ZeroCopyBuffer) Free ¶
func (b *ZeroCopyBuffer) Free()
func (*ZeroCopyBuffer) Ptr ¶
func (b *ZeroCopyBuffer) Ptr() unsafe.Pointer
func (*ZeroCopyBuffer) Release ¶
func (b *ZeroCopyBuffer) Release() int
func (*ZeroCopyBuffer) Size ¶
func (b *ZeroCopyBuffer) Size() int
func (*ZeroCopyBuffer) Slice ¶
func (b *ZeroCopyBuffer) Slice() []byte
type ZeroCopyManager ¶
type ZeroCopyManager struct {
// contains filtered or unexported fields
}
func NewZeroCopyManager ¶
func NewZeroCopyManager(workers int, bufferSizes []int) *ZeroCopyManager
func (*ZeroCopyManager) Close ¶
func (zcm *ZeroCopyManager) Close()
func (*ZeroCopyManager) TransferAsync ¶
func (zcm *ZeroCopyManager) TransferAsync(req TransferRequest)
func (*ZeroCopyManager) TransferSync ¶
func (zcm *ZeroCopyManager) TransferSync(req TransferRequest) error
type ZeroCopyPool ¶
type ZeroCopyPool struct {
// contains filtered or unexported fields
}
func NewZeroCopyPool ¶
func NewZeroCopyPool(sizes []int, maxPerSize int) *ZeroCopyPool
func (*ZeroCopyPool) Acquire ¶
func (p *ZeroCopyPool) Acquire(size int) (*ZeroCopyBuffer, error)
func (*ZeroCopyPool) Release ¶
func (p *ZeroCopyPool) Release(buf *ZeroCopyBuffer)