tensora-taco


Nametensora-taco JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/drhagen/tensora-taco
SummaryPython wrapper around the TACO CLI as an alternative kernel generator for Tensora
upload_time2024-02-16 01:20:30
maintainer
docs_urlNone
authorDavid Hagen
requires_python>=3.10,<4.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # TACO CLI interface for Tensora

This Python package provides a Python wrapper around the CLI tool of the [Tensor Algebra Compiler](http://tensor-compiler.org/) (TACO). This package exists to support the `tensora[taco]` extra of [Tensora](https://tensora.drhagen.com). The main [`tensora`](https://github.com/drhagen/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`](https://returns.readthedocs.io/en/latest/pages/result.html).

```python
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](https://github.com/drhagen/tensora-taco).

### 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:

```shell
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](https://python-poetry.org/docs/) and then use Poetry to install this package and its dependencies:

```shell
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:

```shell
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:

```shell
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:

```shell
poetry run nox -s ruff
```

### Making a release

1. Bump
    1. Increment version in `pyproject.toml`
    2. Commit with message "Bump version number to X.Y.Z"
    3. Push commit to GitHub
    4. Check [CI](https://github.com/drhagen/tensora-taco/actions/workflows/ci.yml) to ensure all tests pass
2. Tag
    1. Tag commit with "vX.Y.Z"
    2. Push tag to GitHub
    3. Wait for [build](https://github.com/drhagen/tensora-taco/actions/workflows/release.yml) to finish
    4. Check [PyPI](https://pypi.org/project/tensora-taco/) for good upload
3. Document
    1. Create [GitHub release](https://github.com/drhagen/tensora-taco/releases) with name "Tensora TACO X.Y.Z" and major changes in body


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/drhagen/tensora-taco",
    "name": "tensora-taco",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "David Hagen",
    "author_email": "david@drhagen.com",
    "download_url": "https://files.pythonhosted.org/packages/12/cb/66f133c5e39f79cf380f094f0a54c12c1eee08097e175346ba1ff6f80079/tensora_taco-0.1.0.tar.gz",
    "platform": null,
    "description": "# TACO CLI interface for Tensora\n\nThis Python package provides a Python wrapper around the CLI tool of the [Tensor Algebra Compiler](http://tensor-compiler.org/) (TACO). This package exists to support the `tensora[taco]` extra of [Tensora](https://tensora.drhagen.com). The main [`tensora`](https://github.com/drhagen/tensora) package is pure Python, and including TACO by default would complicate its distribution.\n\nThe `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`](https://returns.readthedocs.io/en/latest/pages/result.html).\n\n```python\nfrom tensora_taco import taco_cli\n\nresult = taco_cli([\"y(i) = A(i,j) * x(j)\", \"-print-nocolor\", \"-print-compute\"])\n\nkernel = result.unwrap()\n# // Generated by the Tensor Algebra Compiler (tensor-compiler.org)\n#\n# int compute(taco_tensor_t *y, taco_tensor_t *A, taco_tensor_t *x) {\n#   int y1_dimension = (int)(y->dimensions[0]);\n#   double* restrict y_vals = (double*)(y->vals);\n#   int A1_dimension = (int)(A->dimensions[0]);\n#   int A2_dimension = (int)(A->dimensions[1]);\n#   double* restrict A_vals = (double*)(A->vals);\n#   int x1_dimension = (int)(x->dimensions[0]);\n#   double* restrict x_vals = (double*)(x->vals);\n#\n#   #pragma omp parallel for schedule(runtime)\n#   for (int32_t i = 0; i < A1_dimension; i++) {\n#     double tjy_val = 0.0;\n#     for (int32_t j = 0; j < x1_dimension; j++) {\n#       int32_t jA = i * A2_dimension + j;\n#       tjy_val += A_vals[jA] * x_vals[j];\n#     }\n#     y_vals[i] = tjy_val;\n#   }\n#   return 0;\n# }\n```\n\n## Contributing\n\n`tensora-taco` is a free and open source project developed under an MIT license. Development occurs at the [GitHub project](https://github.com/drhagen/tensora-taco).\n\n### Cloning the repo\n\nTo 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:\n\n```shell\ngit clone --recurse-submodules https://github.com/drhagen/tabeline.git\n```\n\n### Installing from source\n\n`tensora-taco` uses Poetry as its packaging and dependency manager. In whatever Python environment you prefer, [install Poetry](https://python-poetry.org/docs/) and then use Poetry to install this package and its dependencies:\n\n```shell\npip install poetry\npoetry install\n```\n\n### Testing\n\n`tensora-taco` uses pytest to run the tests in the `tests/` directory. The test command is encapsulated with Nox:\n\n```shell\npoetry run nox -s test\n```\n\nThis 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:\n\n```shell\npoetry run nox -s test-3.11\n```\n\nIt 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.\n\n\n### Code quality\n\n`tensora-taco` uses Ruff to ensure a minimum standard of code quality. The code quality commands are encapsulated with Nox:\n\n```shell\npoetry run nox -s ruff\n```\n\n### Making a release\n\n1. Bump\n    1. Increment version in `pyproject.toml`\n    2. Commit with message \"Bump version number to X.Y.Z\"\n    3. Push commit to GitHub\n    4. Check [CI](https://github.com/drhagen/tensora-taco/actions/workflows/ci.yml) to ensure all tests pass\n2. Tag\n    1. Tag commit with \"vX.Y.Z\"\n    2. Push tag to GitHub\n    3. Wait for [build](https://github.com/drhagen/tensora-taco/actions/workflows/release.yml) to finish\n    4. Check [PyPI](https://pypi.org/project/tensora-taco/) for good upload\n3. Document\n    1. Create [GitHub release](https://github.com/drhagen/tensora-taco/releases) with name \"Tensora TACO X.Y.Z\" and major changes in body\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python wrapper around the TACO CLI as an alternative kernel generator for Tensora",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/drhagen/tensora-taco",
        "Repository": "https://github.com/drhagen/tensora-taco"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "12cb66f133c5e39f79cf380f094f0a54c12c1eee08097e175346ba1ff6f80079",
                "md5": "72474d6348001f04f7de900e6565fdaa",
                "sha256": "545c0690f0cee6cea8454db4856316464c5a8380768671c9a23d4c657cd4f470"
            },
            "downloads": -1,
            "filename": "tensora_taco-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "72474d6348001f04f7de900e6565fdaa",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10,<4.0",
            "size": 644005,
            "upload_time": "2024-02-16T01:20:30",
            "upload_time_iso_8601": "2024-02-16T01:20:30.488879Z",
            "url": "https://files.pythonhosted.org/packages/12/cb/66f133c5e39f79cf380f094f0a54c12c1eee08097e175346ba1ff6f80079/tensora_taco-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-16 01:20:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "drhagen",
    "github_project": "tensora-taco",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "tensora-taco"
}
        
Elapsed time: 2.90796s