envutil

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: Apache-2.0 Imports: 6 Imported by: 2 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package envutil provides utility functions for working with environment variables.

Index

Constants

View Source
const (
	GoBackendSIMD_AVX512 = "GOMLX_GO_SIMD_AVX512"
	GoBackendSIMD_AVX2   = "GOMLX_GO_SIMD_AVX2"
	GoBackendFusion      = "GOMLX_GO_FUSION"
	GoBackendDotMatmul   = "GOMLX_GO_DOT_MATMUL"
	GoBackendAVX512_ASM  = "GOMLX_GO_AVX512_ASM"
	GoBackendAVX512_KC   = "GOMLX_GO_AVX512_KC"
	GoBackendAVX512_MC   = "GOMLX_GO_AVX512_MC"
	GoBackendAVX512_NC   = "GOMLX_GO_AVX512_NC"
	GoBackendAVX2_ASM    = "GOMLX_GO_AVX2_ASM"
	GoBackendAVX2_KC     = "GOMLX_GO_AVX2_KC"
	GoBackendAVX2_MC     = "GOMLX_GO_AVX2_MC"
	GoBackendAVX2_NC     = "GOMLX_GO_AVX2_NC"
	GoBackendNoSIMD_KC   = "GOMLX_GO_NOSIMD_KC"
	GoBackendNoSIMD_MC   = "GOMLX_GO_NOSIMD_MC"
	GoBackendNoSIMD_NC   = "GOMLX_GO_NOSIMD_NC"
)

Environment variables used by the Go backend: mostly SIMD instructions and optimizations. By default it uses whatever the CPU supports, but this allows one to disable them in case of issues. Note that GOMLX_GO_SIMD_AVX512 and GOMLX_GO_SIMD_AVX2 only control AVX512/AVX2-specific implementations (e.g. specialized matmul and activations), while generic portable SIMD code will still use available vector instructions.

Variables

View Source
var (
	FalseValues = sets.MakeWith("0", "false", "f", "no", "off", "disabled")
	TrueValues  = sets.MakeWith("1", "true", "t", "yes", "on", "enabled")
)

Functions

func MustReadBool

func MustReadBool(name string, defaultValue bool) bool

MustReadBool reads the boolean value of the environment variable with the given name. If not set, it returns the defaultValue.

It panics with an informative error if the value is set but it is not able to parse a valid boolean value.

func MustReadInt added in v0.1.8

func MustReadInt(name string, defaultValue int) int

MustReadInt reads the integer value of the environment variable with the given name. If not set, it returns the defaultValue.

It panics with an informative error if the value is set but it is not able to parse a valid integer value.

func ReadBool

func ReadBool(name string, defaultValue bool) (bool, error)

ReadBool reads the boolean value of the environment variable with the given name. If not set, it returns the defaultValue. It returns an error if the value is set but not a valid boolean value.

func ReadInt

func ReadInt(name string, defaultValue int) (int, error)

ReadInt reads the integer value of the environment variable with the given name. If not set, it returns the defaultValue. It returns an error if the value is set but not a valid integer value.

Types

This section is empty.

Jump to

Keyboard shortcuts

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