TACO CLI interface for Tensora
This Python package provides a Python wrapper around the CLI tool of the Tensor Algebra Compiler (TACO). This package exists to support the tensora[taco] extra of Tensora. The main tensora package is pure Python, and including TACO by default would complicate its distribution.
The tensora-taco Python package contains one function taco_cli that takes the taco CLI arguments of as a list of strings, and returns a Result.
from tensora_taco import taco_cli
result = taco_cli(["y(i) = A(i,j) * x(j)", "-print-nocolor", "-print-compute"])
kernel = result.unwrap()
# // Generated by the Tensor Algebra Compiler (tensor-compiler.org)
#
# int compute(taco_tensor_t *y, taco_tensor_t *A, taco_tensor_t *x) {
# int y1_dimension = (int)(y->dimensions[0]);
# double* restrict y_vals = (double*)(y->vals);
# int A1_dimension = (int)(A->dimensions[0]);
# int A2_dimension = (int)(A->dimensions[1]);
# double* restrict A_vals = (double*)(A->vals);
# int x1_dimension = (int)(x->dimensions[0]);
# double* restrict x_vals = (double*)(x->vals);
#
# #pragma omp parallel for schedule(runtime)
# for (int32_t i = 0; i < A1_dimension; i++) {
# double tjy_val = 0.0;
# for (int32_t j = 0; j < x1_dimension; j++) {
# int32_t jA = i * A2_dimension + j;
# tjy_val += A_vals[jA] * x_vals[j];
# }
# y_vals[i] = tjy_val;
# }
# return 0;
# }
Contributing
tensora-taco is a free and open source project developed under an MIT license. Development occurs at the GitHub project.
Cloning the repo
To make a local copy of tensora-taco, clone the repository with git. This project depends on TACO at build time as a submodule, so it must be cloned as well in order to build the project:
git clone --recurse-submodules https://github.com/drhagen/tabeline.git
Installing from source
tensora-taco uses Poetry as its packaging and dependency manager. In whatever Python environment you prefer, install Poetry and then use Poetry to install this package and its dependencies:
pip install poetry
poetry install
Testing
tensora-taco uses pytest to run the tests in the tests/ directory. The test command is encapsulated with Nox:
poetry run nox -s test
This will try to test with all compatible Python versions that nox can find. To run the tests with only a particular version, run something like this:
poetry run nox -s test-3.11
It is good to run the tests locally before making a PR, but it is not necessary to have all Python versions run. It is rare for a failure to appear in a single version, and the CI will catch it anyway.
Code quality
tensora-taco uses Ruff to ensure a minimum standard of code quality. The code quality commands are encapsulated with Nox:
poetry run nox -s ruff
Making a release
- Bump
- Increment version in
pyproject.toml - Commit with message "Bump version number to X.Y.Z"
- Push commit to GitHub
- Check CI to ensure all tests pass
- Increment version in
- Tag
- Document
- Create GitHub release with name "Tensora TACO X.Y.Z" and major changes in body
Metadata
Release files for tensora-taco 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tensora_taco-0.1.2.tar.gz | 1.3 MB | Without provenance | Details for tensora_taco-0.1.2.tar.gz |
Release files / tensora_taco-0.1.2.tar.gz
| Download URL | tensora_taco-0.1.2.tar.gz |
|---|---|
| Size | 1.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b61fea33cb2468d78d7600f3232ff96847e170af679fd9375e29d9630c4ea5ae
|
|
BLAKE2b-256 checksum How to use checksums |
0b6f84a96ecbf6b518b956537229a3d760e60ec9df26d6bcd69df1d06e93a918
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.8
|
Security for tensora-taco 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.