|
| 1 | +# TensorOperationsTBLIS.jl |
| 2 | +[tblis](https://github.com/devinamatthews/tblis) wrapper for [TensorOperations.jl]() |
| 3 | + |
| 4 | +[![CI][ci-img]][ci-url] [![CI (Julia nightly)][ci-julia-nightly-img]][ci-julia-nightly-url] [![][codecov-img]][codecov-url] |
| 5 | + |
| 6 | +[ci-img]: https://github.com/lkdvos/TensorOperationsTBLIS.jl/actions/workflows/ci.yml/badge.svg |
| 7 | +[ci-url]: https://github.com/lkdvos/TensorOperationsTBLIS.jl/actions/workflows/ci.yml |
| 8 | + |
| 9 | +[ci-julia-nightly-img]: https://github.com/lkdvos/TensorOperationsTBLIS.jl/actions/workflows/ci-julia-nightly.yml/badge.svg |
| 10 | +[ci-julia-nightly-url]: https://github.com/lkdvos/TensorOperationsTBLIS.jl/actions/workflows/ci-julia-nightly.yml |
| 11 | + |
| 12 | +[codecov-img]: https://codecov.io/gh/lkdvos/TensorOperationsTBLIS.jl/branch/master/graph/badge.svg |
| 13 | +[codecov-url]: https://codecov.io/gh/lkdvos/TensorOperationsTBLIS.jl |
| 14 | + |
| 15 | +Currently provides implementations of `tensorcontract!` and `tensoradd!` for `StridedArray{<:BlasFloat}`. These can be accessed through the backend system of TensorOperations, i.e. |
| 16 | +```julia |
| 17 | +using TensorOperations |
| 18 | +using TensorOperationsTBLIS |
| 19 | + |
| 20 | +α = randn() |
| 21 | +A = randn(5, 5, 5, 5, 5, 5) |
| 22 | +B = randn(5, 5, 5) |
| 23 | +C = randn(5, 5, 5) |
| 24 | +D = zeros(5, 5, 5) |
| 25 | + |
| 26 | +@tensor backend = tblis begin |
| 27 | + D2[a, b, c] = A[a, e, f, c, f, g] * B[g, b, e] + α * C[c, a, b] |
| 28 | + E2[a, b, c] := A[a, e, f, c, f, g] * B[g, b, e] + α * C[c, a, b] |
| 29 | +end |
| 30 | +``` |
| 31 | + |
| 32 | +Additionally, the number of threads used by tblis can be set by: |
| 33 | +```julia |
| 34 | +using TensorOperationsTBLIS |
| 35 | +tblis_set_num_threads(4) |
| 36 | +@show tblis_get_num_threads() |
| 37 | +``` |
0 commit comments