mirror of
https://github.com/luxfi/crypto.git
synced 2026-07-27 01:54:50 +00:00
backend: drop LUX_ prefix from env var — GPU_DISABLE
Per "no LUX_ in front of shit for no reason" — the kill switch is a generic GPU-disable knob, not Lux-specific. LUX_GPU_DISABLE → GPU_DISABLE All docs + comments updated. Behavior unchanged.
This commit is contained in:
+1
-1
@@ -102,7 +102,7 @@ func CGoAvailable() bool { return cgoLinked }
|
||||
// GPUAvailable reports whether the luxfi/accel GPU substrate is reachable
|
||||
// in this process. First call lazily initialises accel via gpuhost; the
|
||||
// answer is cached afterwards. Returns false unconditionally when the
|
||||
// LUX_GPU_DISABLE kill switch is set (see disable.go).
|
||||
// GPU_DISABLE kill switch is set (see disable.go).
|
||||
func GPUAvailable() bool {
|
||||
if gpuDisabled {
|
||||
return false
|
||||
|
||||
+9
-9
@@ -8,23 +8,23 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// LUX_GPU_DISABLE is the process-wide operator kill switch for GPU
|
||||
// dispatch. Read exactly once at init; the value is then constant for
|
||||
// the lifetime of the process. Set to a truthy value
|
||||
// (1 / true / yes / on) to force every algorithm dispatcher to its CPU
|
||||
// path regardless of whether a device is present.
|
||||
// GPU_DISABLE is the process-wide operator kill switch for GPU dispatch.
|
||||
// Read exactly once at init; the value is then constant for the lifetime
|
||||
// of the process. Set to a truthy value (1 / true / yes / on) to force
|
||||
// every algorithm dispatcher to its CPU path regardless of whether a
|
||||
// device is present.
|
||||
//
|
||||
// This is orthogonal to GPUAvailable() — that probe answers "is there a
|
||||
// device", this knob answers "should we use it even if there is". Use
|
||||
// cases: GPU driver regression in prod, A/B rollout where some racks
|
||||
// stay on CPU, validators sharing a host with another tenant.
|
||||
const envGPUDisable = "LUX_GPU_DISABLE"
|
||||
const envGPUDisable = "GPU_DISABLE"
|
||||
|
||||
var gpuDisabled = parseTruthy(os.Getenv(envGPUDisable))
|
||||
|
||||
// GPUDisabled reports whether the LUX_GPU_DISABLE kill switch is set.
|
||||
// When true, GPUAvailable() returns false and IsGPU() therefore returns
|
||||
// false, forcing every dispatcher onto its CPU path.
|
||||
// GPUDisabled reports whether the GPU_DISABLE kill switch is set. When
|
||||
// true, GPUAvailable() returns false and IsGPU() therefore returns false,
|
||||
// forcing every dispatcher onto its CPU path.
|
||||
func GPUDisabled() bool { return gpuDisabled }
|
||||
|
||||
// parseTruthy mirrors the convention used by strconv.ParseBool but
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ import (
|
||||
type FallbackReason uint32
|
||||
|
||||
const (
|
||||
// FallbackDisabled — LUX_GPU_DISABLE is set; dispatcher routed to CPU.
|
||||
// FallbackDisabled — GPU_DISABLE is set; dispatcher routed to CPU.
|
||||
FallbackDisabled FallbackReason = iota
|
||||
// FallbackUnsupported — host driver reported no usable device
|
||||
// (cudaGetDeviceCount == 0, Metal device init failed, etc.).
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ type Snapshot struct {
|
||||
// GPU reports whether luxfi/accel found at least one device. Always
|
||||
// false when Disabled is true, regardless of the underlying probe.
|
||||
GPU bool
|
||||
// Disabled reflects the LUX_GPU_DISABLE operator kill switch.
|
||||
// Disabled reflects the GPU_DISABLE operator kill switch.
|
||||
Disabled bool
|
||||
// GPUBackend names the active accel backend ("metal" / "cuda" /
|
||||
// "webgpu") or "" when no GPU is available.
|
||||
|
||||
Reference in New Issue
Block a user