🚧🏗️ EXPERIMENTAL 🏗️🚧
ONNX Runtime based compute backend for GoMLX.
It allows GoMLX models to be executed via ONNX Runtime using either CPU or CUDA (NVIDIA GPU).
To run the Adult dataset demo with the ONNX backend:
GOMLX_BACKEND=onnx go run -tags=onnx github.com/gomlx/gomlx/examples/adult/demoOr targeting a specific accelerator (e.g. CUDA):
GOMLX_BACKEND=onnx:cuda go run -tags=onnx github.com/gomlx/gomlx/examples/adult/demoConfiguration can be specified in the GOMLX_BACKEND environment variable using onnx:<options> or onnxruntime:<options> (comma-separated).
cpu: Force CPU execution.GOMLX_BACKEND=onnx:cpu
cuda/gpu: Force CUDA GPU execution (uses ONNX Runtime CUDA Execution Provider viaOrtIoBinding).GOMLX_BACKEND=onnx:cuda
- empty (default): Automatically detects if an NVIDIA GPU is present via
nvidia-smiand defaults to CUDA if available, otherwise falling back to CPU.GOMLX_BACKEND=onnx
-
Backend Log Level (
log=<level>): Configures ONNX Runtime's internal logging severity level.log=0: Errors only (severity level 3 / ERROR)log=1: Warnings (severity level 2 / WARNING)log=2: Informational (severity level 1 / INFO)log=3: Verbose (severity level 0 / VERBOSE)
Example:
GOMLX_BACKEND="onnx:cuda,log=2" -
Execution Timing Log (
-vmodule=executable=1): Enables per-step execution timing breakdown printed viaklogusinghumanize.Duration.Example:
GOMLX_BACKEND=onnx:cuda go run -tags=onnx github.com/gomlx/gomlx/examples/adult/demo -vmodule=executable=1