server

package
v0.13.3-1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const GBtoMB = 1024

GBtoMB is a conversion constant from GB to MB (1 GB = 1024 MB)

Variables

This section is empty.

Functions

This section is empty.

Types

type ComputeInstance

type ComputeInstance struct {
	mock.ComputeInstance
	Info nvml.ComputeInstanceInfo
}

ComputeInstance provides a reusable compute instance implementation

func NewComputeInstanceFromInfo

func NewComputeInstanceFromInfo(info nvml.ComputeInstanceInfo) *ComputeInstance

NewComputeInstanceFromInfo creates a new compute instance

func (*ComputeInstance) SetMockFuncs

func (ci *ComputeInstance) SetMockFuncs()

SetMockFuncs configures all the mock function implementations for the compute instance

type CudaComputeCapability

type CudaComputeCapability struct {
	Major int
	Minor int
}

CudaComputeCapability represents CUDA compute capability

type Device

type Device struct {
	mock.Device
	sync.RWMutex
	Config             gpus.Config // Embedded configuration
	UUID               string
	PciBusID           string
	Minor              int
	Index              int
	MigMode            int
	GpuInstances       map[*GpuInstance]struct{}
	GpuInstanceCounter uint32
	MemoryInfo         nvml.Memory
}

Device provides a reusable device implementation

func NewDeviceFromConfig

func NewDeviceFromConfig(config gpus.Config, index int) *Device

NewDeviceFromConfig creates a new device from the provided GPU configuration

func (*Device) SetMockFuncs

func (d *Device) SetMockFuncs()

SetMockFuncs configures all the mock function implementations for the device

type GpuInstance

type GpuInstance struct {
	mock.GpuInstance
	sync.RWMutex
	Info                   nvml.GpuInstanceInfo
	ComputeInstances       map[*ComputeInstance]struct{}
	ComputeInstanceCounter uint32
	MIGProfiles            gpus.MIGProfileConfig
}

GpuInstance provides a reusable GPU instance implementation

func NewGpuInstanceFromInfo

func NewGpuInstanceFromInfo(info nvml.GpuInstanceInfo, profiles gpus.MIGProfileConfig) *GpuInstance

NewGpuInstanceFromInfo creates a new GPU instance

func (*GpuInstance) SetMockFuncs

func (gi *GpuInstance) SetMockFuncs()

SetMockFuncs configures all the mock function implementations for the GPU instance

type Option

type Option func(*options) error

func WithCUDADriverVersion

func WithCUDADriverVersion(version int) Option

TODO: Add a string implementation using generics

func WithDriverVersion

func WithDriverVersion(version string) Option

func WithGPUs

func WithGPUs(gpus ...gpus.Config) Option

func WithNVMLVersion

func WithNVMLVersion(version string) Option

type Server

type Server struct {
	mock.Interface
	mock.ExtendedInterface
	Devices           []nvml.Device
	DriverVersion     string
	NvmlVersion       string
	CudaDriverVersion int
}

Server provides a reusable server implementation

func New

func New(opts ...Option) (*Server, error)

func NewServerWithGPUs

func NewServerWithGPUs(driverVersion, nvmlVersion string, cudaDriverVersion int, gpuConfigs ...gpus.Config) *Server

NewServerWithGPUs creates a new server with heterogeneous GPU configurations

func (*Server) SetMockFuncs

func (s *Server) SetMockFuncs()

SetMockFuncs configures all the mock function implementations for the server

Jump to

Keyboard shortcuts

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