{"id":13699661,"url":"https://github.com/tensor-compiler/taco","last_synced_at":"2025-05-15T19:07:28.826Z","repository":{"id":37445199,"uuid":"69196911","full_name":"tensor-compiler/taco","owner":"tensor-compiler","description":"The Tensor Algebra Compiler (taco) computes sparse tensor expressions on CPUs and GPUs","archived":false,"fork":false,"pushed_at":"2024-04-14T08:10:55.000Z","size":7101,"stargazers_count":1292,"open_issues_count":203,"forks_count":192,"subscribers_count":57,"default_branch":"master","last_synced_at":"2025-04-08T00:37:21.370Z","etag":null,"topics":["code-generator","library","linear-algebra","sparse","tensor","tensor-algebra","tensor-algebra-compiler"],"latest_commit_sha":null,"homepage":"http://tensor-compiler.org","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tensor-compiler.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-25T23:35:22.000Z","updated_at":"2025-04-07T19:09:52.000Z","dependencies_parsed_at":"2023-02-12T00:01:25.047Z","dependency_job_id":"3735d4b2-cf2b-41c8-9f64-ff927866c1a8","html_url":"https://github.com/tensor-compiler/taco","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tensor-compiler%2Ftaco","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tensor-compiler%2Ftaco/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tensor-compiler%2Ftaco/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tensor-compiler%2Ftaco/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tensor-compiler","download_url":"https://codeload.github.com/tensor-compiler/taco/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254404357,"owners_count":22065641,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-generator","library","linear-algebra","sparse","tensor","tensor-algebra","tensor-algebra-compiler"],"created_at":"2024-08-02T20:00:41.269Z","updated_at":"2025-05-15T19:07:28.806Z","avatar_url":"https://github.com/tensor-compiler.png","language":"C++","readme":"The Tensor Algebra Compiler (taco) is a C++ library that computes\ntensor algebra expressions on sparse and dense tensors.  It uses novel\ncompiler techniques to get performance competitive with hand-optimized\nkernels in widely used libraries for both sparse tensor algebra and\nsparse linear algebra.\n\nYou can use taco as a C++ library that lets you load tensors, read\ntensors from files, and compute tensor expressions.  You can also use\ntaco as a code generator that generates C functions that compute\ntensor expressions.\n\nLearn more about taco at\n[tensor-compiler.org](http://tensor-compiler.org), in the paper\n[The Tensor Algebra Compiler](http://tensor-compiler.org/files/kjolstad-oopsla17-tensor-compiler.pdf),\nor in [this talk](https://youtu.be/Kffbzf9etLE).  To learn more about\nwhere taco is going in the near-term, see the technical reports on\n[optimization](https://arxiv.org/abs/1802.10574) and\n[formats](https://arxiv.org/abs/1804.10112).\n\nYou can also subscribe to the\n[taco-announcements](https://lists.csail.mit.edu/mailman/listinfo/taco-announcements)\nemail list where we post announcements, RFCs, and notifications of API\nchanges, or the [taco-discuss](https://lists.csail.mit.edu/mailman/listinfo/taco-discuss)\nemail list for open discussions and questions.\n\nTL;DR build taco using CMake. Run `make test`.\n\n\n# Build and test\n![Build and Test](https://github.com/RSenApps/taco/workflows/Build%20and%20Test/badge.svg?branch=master)\n\nBuild taco using CMake 3.4.0 or greater:\n\n    cd \u003ctaco-directory\u003e\n    mkdir build\n    cd build\n    cmake -DCMAKE_BUILD_TYPE=Release ..\n    make -j8\n\nBuilding taco requires `gcc` 5.0 or newer, or `clang` 3.9 or newer.  You can\nuse a specific compiler or version by setting the `CC` and `CXX` environment\nvariables before running `cmake`.\n\n## Building Python API\nTo build taco with the Python API (pytaco), add `-DPYTHON=ON` to the cmake line above. For example:\n\n    cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON=ON ..\n\nYou will then need to add the pytaco module to PYTHONPATH:\n\n    export PYTHONPATH=\u003ctaco-directory\u003e/build/lib:$PYTHONPATH\n\nThis requires Python 3.x and some development libraries.  It also requires\nNumPy and SciPy to be installed.  For Debian/Ubuntu, the following packages\nare needed: `python3 libpython3-dev python3-distutils python3-numpy python3-scipy`.\n\n## Building for OpenMP\nTo build taco with support for parallel execution (using OpenMP), add `-DOPENMP=ON` to the cmake line above. For example:\n\n    cmake -DCMAKE_BUILD_TYPE=Release -DOPENMP=ON ..\n\nIf you are building with the `clang` compiler, you may need to ensure that\nthe `libomp` development headers are installed.  For Debian/Ubuntu, this is\nprovided by `libomp-dev`, One of the more specific versions like\n`libomp-13-dev` may also work.\n\n## Building for CUDA\nTo build taco for NVIDIA CUDA, add `-DCUDA=ON` to the cmake line above. For example:\n\n    cmake -DCMAKE_BUILD_TYPE=Release -DCUDA=ON ..\n\nPlease also make sure that you have CUDA installed properly and that the following environment variables are set correctly:\n\n    export PATH=/usr/local/cuda/bin:$PATH\n    export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH\n    export LIBRARY_PATH=/usr/local/cuda/lib64:$LIBRARY_PATH\n\nIf you do not have CUDA installed, you can still use the taco cli to generate CUDA code with the -cuda flag.\n\nThe generated CUDA code will require compute capability 6.1 or higher to run.\n\n## Generating documentation\nTo generate documentation for the Python API:\n\n    cd \u003ctaco-directory\u003e/python_bindings\n    make html\n\nBefore generating the documentation, you must have built the Python API (by\nfollowing the [instructions above](#building-python-api)) as well as installed\nthe following dependencies:\n\n    pip install sphinx\n    pip install numpydoc\n    pip install sphinx-rtd-theme\n\n## Running tests\nTo run all tests:\n\n    cd \u003ctaco-directory\u003e/build\n    make test\n\nTests can be run in parallel by setting `CTEST_PARALLEL_LEVEL=\u003cn\u003e` in the environment (which runs `\u003cn\u003e` tests in parallel).\n\nTo run the C++ test suite individually:\n\n    cd \u003ctaco-directory\u003e\n    ./build/bin/taco-test\n\nTo run the Python test suite individually:\n\n    cd \u003ctaco-directory\u003e\n    python3 build/python_bindings/unit_tests.py\n\n\n## Code coverage analysis\n\nTo enable code coverage analysis, configure with `-DCOVERAGE=ON`.  This requires\nthe `gcovr` tool to be installed in your PATH.\n\nFor best results, the build type should be set to `Debug`.  For example:\n\n    cmake -DCMAKE_BUILD_TYPE=Debug -DCOVERAGE=ON ..\n\nThen to run code coverage analysis:\n\n    make gcovr\n\nThis will run the test suite and produce some coverage analysis.  This process\nrequires that the tests pass, so any failures must be fixed first.\nIf all goes well, coverage results will be output to the `coverage/` folder.\nSee `coverage/index.html` for a high level report, and click individual files\nto see the line-by-line results.\n\n# Library example\n\nThe following sparse tensor-times-vector multiplication example in C++\nshows how to use the taco library.\n\n```C++\n// Create formats\nFormat csr({Dense,Sparse});\nFormat csf({Sparse,Sparse,Sparse});\nFormat  sv({Sparse});\n\n// Create tensors\nTensor\u003cdouble\u003e A({2,3},   csr);\nTensor\u003cdouble\u003e B({2,3,4}, csf);\nTensor\u003cdouble\u003e c({4},     sv);\n\n// Insert data into B and c\nB.insert({0,0,0}, 1.0);\nB.insert({1,2,0}, 2.0);\nB.insert({1,2,1}, 3.0);\nc.insert({0}, 4.0);\nc.insert({1}, 5.0);\n\n// Pack inserted data as described by the formats\nB.pack();\nc.pack();\n\n// Form a tensor-vector multiplication expression\nIndexVar i, j, k;\nA(i,j) = B(i,j,k) * c(k);\n\n// Compile the expression\nA.compile();\n\n// Assemble A's indices and numerically compute the result\nA.assemble();\nA.compute();\n\nstd::cout \u003c\u003c A \u003c\u003c std::endl;\n```\n\n\n# Code generation tools\n\nIf you just need to compute a single tensor kernel you can use the\n[taco online tool](http://tensor-compiler.org/codegen.html) to generate\na custom C library.  You can also use the taco command-line tool to\nthe same effect:\n\n    cd \u003ctaco-directory\u003e\n    ./build/bin/taco\n    Usage: taco [options] \u003cindex expression\u003e\n\n    Examples:\n      taco \"a(i) = b(i) + c(i)\"                            # Dense vector add\n      taco \"a(i) = b(i) + c(i)\" -f=b:s -f=c:s -f=a:s       # Sparse vector add\n      taco \"a(i) = B(i,j) * c(j)\" -f=B:ds                  # SpMV\n      taco \"A(i,l) = B(i,j,k) * C(j,l) * D(k,l)\" -f=B:sss  # MTTKRP\n\n    Options:\n      ...\n\nFor more information, see our paper on the taco tools\n[taco: A Tool to Generate Tensor Algebra Kernels](http://tensor-compiler.org/files/kjolstad-ase17-taco-tools.pdf).\n","funding_links":[],"categories":["C++","Linear Algebra / Statistics Toolkit"],"sub_categories":["General Purpose Tensor Library"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftensor-compiler%2Ftaco","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftensor-compiler%2Ftaco","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftensor-compiler%2Ftaco/lists"}