Command-line tools for inspecting Tensara problems, generating starter code, running sample checks, checking correctness, benchmarking, and submitting GPU programming solutions.
The CLI is designed for both humans and coding agents. Human-readable output is the default. Use --json when you want machine-readable problem data, sample outputs, checker results, or benchmark metrics.
Linux/macOS:
curl -sSL https://get.tensara.org/install.sh | bashWindows:
iwr -useb https://get.tensara.org/install.sh | iexCheck your installed version:
tensara --versionRecommended CLI version for the current API:
tensara 0.3.0
If you installed from the install script, rerun it:
curl -sSL https://get.tensara.org/install.sh | bashIf you installed with Cargo from crates.io:
cargo install tensara --forceIf you installed from a local checkout:
git pull
cargo install --path . --forceThe CLI defaults to the production API:
https://tensara.org
For local development:
export TENSARA_API_BASE_URL=http://localhost:3000You can override individual routes while debugging:
export CHECKER_ENDPOINT=http://localhost:3000/api/submissions/checker
export BENCHMARK_ENDPOINT=http://localhost:3000/api/submissions/benchmark
export SUBMIT_ENDPOINT=http://localhost:3000/api/submissions/direct-submit
export SAMPLE_ENDPOINT=http://localhost:3000/api/submissions/sampleAuthenticate with a Tensara API key:
tensara auth -t <token>API keys are stored in:
~/.tensara/auth.json
List problems:
tensara problemsList problems as JSON:
tensara problems --jsonShow one problem, including description and PyTorch reference:
tensara problem vector-additionMachine-readable problem details:
tensara problem vector-addition --jsonThe JSON view includes:
- Problem metadata, including
slug,title,difficulty,author, andtags. - Full problem
description. - Full Python problem
definition. - Extracted PyTorch
reference_solution. - ABI
parameters. - Generated starter code under
starters.cuda,starters.python,starters.mojo,starters.cute, andstarters.cutile.
Reference only:
tensara problem vector-addition --reference-onlyDescription only:
tensara problem vector-addition --description-onlyGenerate starter files for a problem:
tensara init ./vector-addition -p vector-addition -l cudaSupported languages:
tensara init ./vector-addition -p vector-addition -l cuda
tensara init ./vector-addition -p vector-addition -l python
tensara init ./vector-addition -p vector-addition -l mojo
tensara init ./vector-addition -p vector-addition -l cute
tensara init ./vector-addition -p vector-addition -l cutileGenerated files include the problem description and starter solution code.
Run your solution against the problem sample case:
tensara sample -g T4 -p vector-addition -s solution.cuMachine-readable sample output:
tensara sample -g T4 -p vector-addition -s solution.cu --jsonThe sample command prints the input, expected output, actual output, debug info on failure, and captured stdout/stderr when available.
Check correctness:
tensara checker -g T4 -p vector-addition -s solution.cuCheck correctness as JSON:
tensara checker -g T4 -p vector-addition -s solution.cu --jsonBenchmark performance:
tensara benchmark -g T4 -p vector-addition -s solution.cuBenchmark performance as JSON:
tensara benchmark -g T4 -p vector-addition -s solution.cu --jsonSubmit for official evaluation:
tensara submit -g T4 -p vector-addition -s solution.cuSupported solution file extensions:
.cu
.py
.mojo
Python-based language modes share the .py extension. By default, .py files are sent as Triton/Python. Use --language to submit CuTe DSL or cuTile Python:
tensara sample -p vector-addition -s sol.cute.py --language cute --json
tensara sample -p vector-addition -s sol.cutile.py --language cutile --jsonAgents should prefer JSON output and generated starters. A reliable agent workflow is:
tensara problem <slug> --json
tensara init ./workspace -p <slug> -l mojo
tensara sample -p <slug> -s ./workspace/sol.mojo --json
tensara checker -p <slug> -s ./workspace/sol.mojo --json
tensara benchmark -p <slug> -s ./workspace/sol.mojo --jsonFor CUDA:
tensara init ./workspace -p <slug> -l cuda
tensara sample -p <slug> -s ./workspace/sol.cu --jsonFor Python/Triton:
tensara init ./workspace -p <slug> -l python
tensara sample -p <slug> -s ./workspace/sol.py --jsonFor CuTe DSL:
tensara init ./workspace -p <slug> -l cute
tensara sample -p <slug> -s ./workspace/sol.cute.py --language cute --jsonFor cuTile Python:
tensara init ./workspace -p <slug> -l cutile
tensara sample -p <slug> -s ./workspace/sol.cutile.py --language cutile --jsonThe problem --json response is intended to be self-contained for agents. It includes the problem description, PyTorch reference, ABI parameters, and starter code for every supported language.
Agent-specific notes:
- Pointer parameters in CUDA and Mojo starters are device pointers.
.pyfiles default topython; pass--language cuteor--language cutilefor CuTe DSL and cuTile Python.- Mojo pointer parameters are passed as raw address
Intvalues and reconstructed withUnsafePointer. - Output pointers refer to preallocated output tensors; solutions should write into those outputs.
- If a parameter is a pointer, do not assume it can be read on the host side in a Mojo wrapper. Read device pointer data from inside a launched kernel.
- Use
sample --jsonfirst because it gives the fastest feedback loop. - Use
checker --jsonfor full correctness. - Use
benchmark --jsonfor runtime and GFLOPS data.
The CLI reports HTTP errors before attempting to parse streaming responses. Common cases include:
401: missing or invalid authentication.404: endpoint or backend mismatch.429: rate limit exceeded.5xx: server-side failure.
Runtime failures, wrong answers, time limit exceeded, and output limit exceeded statuses are surfaced in the CLI output. Use --json for structured status fields that agents can parse.
If you see endpoint errors during local development, check TENSARA_API_BASE_URL and any per-route overrides.
Run the CLI from source with arguments after --:
cargo run -- problem vector-addition --json
cargo run -- sample -p vector-addition -s ../actual/tensara/testing/solutions/vector-addition.cu --jsonRun tests:
cargo testFormat:
cargo fmtRemove the binary:
sudo rm /usr/local/bin/tensara