Documentation
¶
Index ¶
- Constants
- Variables
- func AMDROCmVersion(root string) (version string, err error)
- func AMDROCmVersionEvaluator(specifier string, dc *DeployContext) (int, error)
- func Arch(root string) (arch string, err error)
- func ArchEvaluator(specifier string, dc *DeployContext) (int, error)
- func CUDAToolkitVersionEvaluator(specifier string, dc *DeployContext) (int, error)
- func EvaluatePythonVersion(specifier string, pythonVersion string) (int, error)
- func GetAptInstalled(root string) (installed map[string]string, err error)
- func GetAptSources(root string) (srcs []string, err error)
- func LibCVersion(root string) (major int, minor int, err error)
- func NvidiaDriverVersion(root string) (version string, err error)
- func PythonBinPath(root string) (binPath string, err error)
- func PythonVersion(root string) (major int, minor int, err error)
- func PythonVersionEvaluator(specifier string, dc *DeployContext) (int, error)
- type DeployContext
- func (dc *DeployContext) Evaluate(deployability *Deployability) (result int, err error)
- func (d *DeployContext) Get(key string) (data any, exists bool)
- func (d DeployContext) Has(key string) bool
- func (d *DeployContext) MapGet(key string, mapKey string) (value any, err error)
- func (d *DeployContext) MapSet(key string, mapKey string, mapValue any) error
- func (d *DeployContext) Merge(newContext *DeployContext) (err error)
- func (d *DeployContext) Set(key string, value any) (err error)
- func (d *DeployContext) SetAMDROCmVersion(root string) (err error)
- func (d *DeployContext) SetArch(root string) (err error)
- func (d *DeployContext) SetLibCVersion(root string) (err error)
- func (d *DeployContext) SetNvidiaDriverVersion(root string) (err error)
- func (d *DeployContext) SetPythonBinPath(root string) (err error)
- func (d *DeployContext) SetPythonVersion(root string) (err error)
- func (d *DeployContext) SliceAppend(key string, newItem any) error
- func (d *DeployContext) SliceContains(key string, query any) (exist bool, err error)
- func (d DeployContext) String() string
- type Deployability
- type DeployabilityEvaluator
- type NvidiaMap
Constants ¶
const AMD_ROCM_VERSION = "amd.rocmVersion"
const ARCH_KEY = "hardware.architecture"
const CUDA_TOOLKIT_VERSION = "nvidia.cudaVersion"
const LIBC_VERSION = "os.libcVersion"
const NVIDIA_DRIVER_VERSION = "nvidia.driverVersion"
const PYTHON_BIN_PATH = "os.pythonBinPath"
const PYTHON_VERSION_KEY = "os.pythonVersion"
Variables ¶
var DeployabilityEvaluators = make(map[string]DeployabilityEvaluator)
Functions ¶
func AMDROCmVersion ¶ added in v0.2.0
func AMDROCmVersionEvaluator ¶ added in v0.2.0
func AMDROCmVersionEvaluator(specifier string, dc *DeployContext) (int, error)
func Arch ¶
Get system architure by reading "/var/lib/dpkg/status" and get package info of libc6 All possible archs includes: amd64, arm64, armel, armhf, i386, mips64el, mipsel, ppc64el, riscv64, s390x
func ArchEvaluator ¶
func ArchEvaluator(specifier string, dc *DeployContext) (int, error)
func CUDAToolkitVersionEvaluator ¶
func CUDAToolkitVersionEvaluator(specifier string, dc *DeployContext) (int, error)
specifer is the CUDA toolkit Version, for example 12.6 or 11.5 value is the nvidia driver version
func EvaluatePythonVersion ¶
func GetAptSources ¶
func LibCVersion ¶
Get system glibc version [major.minor] by reading "/var/lib/dpkg/status" and get package info of libc6
func NvidiaDriverVersion ¶
func PythonBinPath ¶
func PythonVersion ¶
Get python version [major.minor]
func PythonVersionEvaluator ¶
func PythonVersionEvaluator(specifier string, dc *DeployContext) (int, error)
specifier should be like `>=3.5`, `< 3.11.3`, ` ~=3.0` minor version number is required patch version number is optional
Types ¶
type DeployContext ¶
func ParseDeployContext ¶
func ParseDeployContext(jsonStr string) (d *DeployContext, err error)
func (*DeployContext) Evaluate ¶
func (dc *DeployContext) Evaluate(deployability *Deployability) (result int, err error)
The evaluated deployability is an integer between 0 and 255 0 indicates not deployable 127 is the default result 255 indicates perfect match
func (DeployContext) Has ¶
func (d DeployContext) Has(key string) bool
func (*DeployContext) MapGet ¶
func (d *DeployContext) MapGet(key string, mapKey string) (value any, err error)
func (*DeployContext) MapSet ¶
func (d *DeployContext) MapSet(key string, mapKey string, mapValue any) error
func (*DeployContext) Merge ¶
func (d *DeployContext) Merge(newContext *DeployContext) (err error)
func (*DeployContext) Set ¶
func (d *DeployContext) Set(key string, value any) (err error)
for a given key, if the key doesn't exist in the context, directly add the value to the context if the key exists in the context, switch the current value to the new value
func (*DeployContext) SetAMDROCmVersion ¶ added in v0.2.0
func (d *DeployContext) SetAMDROCmVersion(root string) (err error)
func (*DeployContext) SetArch ¶
func (d *DeployContext) SetArch(root string) (err error)
func (*DeployContext) SetLibCVersion ¶
func (d *DeployContext) SetLibCVersion(root string) (err error)
func (*DeployContext) SetNvidiaDriverVersion ¶
func (d *DeployContext) SetNvidiaDriverVersion(root string) (err error)
func (*DeployContext) SetPythonBinPath ¶
func (d *DeployContext) SetPythonBinPath(root string) (err error)
func (*DeployContext) SetPythonVersion ¶
func (d *DeployContext) SetPythonVersion(root string) (err error)
func (*DeployContext) SliceAppend ¶
func (d *DeployContext) SliceAppend(key string, newItem any) error
func (*DeployContext) SliceContains ¶
func (d *DeployContext) SliceContains(key string, query any) (exist bool, err error)
Works for slice and array
func (DeployContext) String ¶
func (d DeployContext) String() string
type Deployability ¶
func ParseDeployability ¶
func ParseDeployability(jsonStr string) (*Deployability, error)
func (*Deployability) Add ¶
func (d *Deployability) Add(key string, value string)
func (*Deployability) String ¶
func (d *Deployability) String() string
type DeployabilityEvaluator ¶
type DeployabilityEvaluator func(string, *DeployContext) (int, error)