prereq

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package prereq detects whether prerequisite external tools are installed and provides platform-appropriate install guidance. It bundles nothing: the Install hints are advisory strings that point at official sources. The catalog and helpers are designed to be importable so the doctor command can reuse the same guidance via HintFor.

Index

Constants

This section is empty.

Variables

View Source
var Tools = []Tool{
	{
		Name:    "nvidia-smi",
		Binary:  "nvidia-smi",
		Purpose: "NVIDIA GPU query/management",
		Install: map[string]string{
			"debian":  "apt install nvidia-driver-<ver>",
			"rhel":    "dnf install nvidia-driver",
			"generic": "install the NVIDIA driver (nvidia.com/download) or use --gpus in containers",
		},
	},
	{
		Name:    "ibv_devinfo",
		Binary:  "ibv_devinfo",
		Purpose: "RDMA device/port info",
		Install: map[string]string{
			"debian": "apt install ibverbs-utils rdma-core",
			"rhel":   "dnf install libibverbs-utils rdma-core",
			"source": "install MLNX_OFED / DOCA-OFED from NVIDIA Networking",
		},
	},
	{
		Name:    "ibstat",
		Binary:  "ibstat",
		Purpose: "InfiniBand/RoCE port state",
		Install: map[string]string{
			"debian": "apt install infiniband-diags",
			"rhel":   "dnf install infiniband-diags",
			"source": "MLNX_OFED / DOCA-OFED",
		},
	},
	{
		Name:    "perftest",
		Binary:  "ib_write_bw",
		Purpose: "RDMA bandwidth/latency benchmark",
		Install: map[string]string{
			"debian": "apt install perftest",
			"rhel":   "dnf install perftest",
			"source": "build github.com/linux-rdma/perftest (--use_cuda for GDR)",
		},
	},
	{
		Name:    "nccl-tests",
		Binary:  "all_reduce_perf",
		Purpose: "NCCL collective bandwidth (busbw)",
		Install: map[string]string{
			"source":  "build github.com/NVIDIA/nccl-tests (make MPI=1 ...)",
			"generic": "build github.com/NVIDIA/nccl-tests (make MPI=1 ...)",
		},
	},
	{
		Name:    "dcgm",
		Binary:  "dcgmi",
		Purpose: "Data Center GPU Manager diagnostics",
		Install: map[string]string{
			"debian": "install datacenter-gpu-manager",
			"rhel":   "install datacenter-gpu-manager",
			"source": "docs.nvidia.com/datacenter/dcgm",
		},
	},
}

Tools is the prerequisite catalog. These are guidance strings only; nothing is bundled or installed.

Functions

func DetectDistro

func DetectDistro() string

DetectDistro reads the ID field of /etc/os-release and maps it to a distro family: "debian", "rhel", or "generic". It also consults ID_LIKE so downstream derivatives (e.g. ubuntu, rocky) resolve to their family. If the file is missing or unreadable, it returns "generic".

func HintFor

func HintFor(binary string) string

HintFor returns the best install hint for a given binary using the current distro. It returns "" if the binary is not in the catalog. Used by the doctor command to enrich its fail/warn hints.

Types

type CheckResult

type CheckResult struct {
	Tool    string `json:"tool"`
	Binary  string `json:"binary"`
	Found   bool   `json:"found"`
	Path    string `json:"path"`
	Purpose string `json:"purpose"`
	Install string `json:"install"`
}

CheckResult is the detection result for one Tool. Install holds the single hint chosen for the current distro, so consumers need not re-run detection.

func Check

func Check() []CheckResult

Check runs lookPath on each tool's binary and records whether it was found, its resolved path, and the install hint chosen for the current distro.

type Tool

type Tool struct {
	Name    string            `json:"name"`
	Binary  string            `json:"binary"`
	Purpose string            `json:"purpose"`
	Install map[string]string `json:"install"`
}

Tool describes a single prerequisite external tool and its per-distro install guidance. Install maps a distro family key ("debian"/"rhel"/"source"/ "generic") to a one-line install hint.

Jump to

Keyboard shortcuts

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