You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
List of environment variables that control tinygrad behavior.
This is a list of environment variable that control the runtime behavior of tinygrad and its examples.
Most of these are self-explanatory, and are usually used to set an option at runtime.
Example: GPU=1 DEBUG=4 python3 -m pytest
However you can also decorate a function to set a value only inside that function.
# in tensor.py (probably only useful if you are a tinygrad developer)@Context(DEBUG=4)defnumpy(self) -> ...
Or use contextmanager to temporarily set a value inside some scope:
withContext(DEBUG=0):
a=Tensor.ones(10, 10)
a*=2
Global Variables
The columns of this list are are: Variable, Possible Value(s) and Description.
A # means that the variable can take any integer value.
These control the behavior of core tinygrad even when used as a library.
Variable
Possible Value(s)
Description
DEBUG
[1-4]
enable debugging output, with 4 you get operations, timings, speed, generated code and more
GPU
[1]
enable the GPU backend
CUDA
[1]
enable CUDA backend
CPU
[1]
enable CPU backend
MPS
[1]
enable MPS device (for Mac M1 and after)
METAL
[1]
enable Metal backend (for Mac M1 and after)
METAL_XCODE
[1]
enable Metal using macOS Xcode SDK
TORCH
[1]
enable PyTorch backend
CLANG
[1]
enable Clang backend
LLVM
[1]
enable LLVM backend
LLVMOPT
[1]
enable slightly more expensive LLVM optimizations
LAZY
[1]
enable lazy operations (this is the default)
OPT
[1-3]
optimization level
KOPT
[1-2]
kernel optimization, 1 turns it on, 2 caches the found optimizations
BUDGET
[#]
kernel optimization search budget
GRAPH
[1]
create a graph of all operations (requires graphviz)
GRAPHPATH
[/path/to]
where to put the generated graph
PRUNEGRAPH
[1]
prune MovementOps and LoadOps from the graph
PRINT_PRG
[1]
print program code
IMAGE
[1]
enable 2d specific optimizations
FLOAT16
[1]
use float16 for images instead of float32
ENABLE_METHOD_CACHE
[1]
enable method cache (this is the default)
DISALLOW_ASSIGN
[1]
disallow assignment of tensors
CL_EXCLUDE
[name0,name1]
comma-separated list of device names to exclude when using OpenCL GPU backend (like CL_EXCLUDE=gfx1036)
CL_PLATFORM
[# >= 0]
index of the OpenCL platform to run on. Defaults to 0.
RDNA
[1]
enable the specialized RDNA 3 assembler for AMD 7000-series GPUs. If not set, defaults to generic OpenCL codegen backend.
PTX
[1]
enable the specialized PTX assembler for Nvidia GPUs. If not set, defaults to generic CUDA codegen backend.
File Specific Variables
These are variables that control the behavior of a specific file, these usually don't affect the library itself.
Most of the time these will never be used, but they are here for completeness.