Skip to main content

Python bindings for TBLIS, a high performance library for tensor operations

Project description

pytblis: Python bindings for TBLIS

Actions Status GitHub Discussion

Are your einsums too slow?

Need FP64 tensor contractions and can't buy a datacenter GPU because you already maxed out your home equity line of credit?

Set your CPU on fire with TBLIS!

Installation

pip install pytblis

Usage

pytblis.einsum and pytblis.tensordot are drop-in replacements for numpy.einsum and numpy.tensordot.

In addition, low level wrappers are provided for tblis_tensor_add, tblis_tensor_mult, tblis_tensor_reduce, tblis_tensor_shift, and tblis_tensor_dot. These are named pytblis.add, pytblis.mult, et cetera.

Finally, there are mid-level convenience wrappers for tblis_tensor_mult and tblis_tensor_add:

def contract(
    subscripts: str,
    a: ArrayLike,
    b: ArrayLike,
    alpha: scalar = 1.0,
    beta: scalar = 0.0,
    out: Optional[npt.ArrayLike] = None,
    conja: bool = False,
    conjb: bool = False,
) -> ArrayLike

and

def transpose_add(
    subscripts: str,
    a: ArrayLike,
    alpha: scalar = 1.0,
    beta: scalar = 0.0,
    out: Optional[ArrayLike] = None,
    conja: bool = False,
    conjout: bool = False,
) -> ArrayLike

These are used as follows:

C = pytblis.contract("ij,jk->ik", A, B, alpha=1.0, beta=0.5, out=C, conja=True, conjb=False)

does

$$C \gets \overline{A} B + \frac{1}{2} C.$$

B = pytblis.tensor_add("iklj->ijkl", A, alpha=-1.0, beta=1.0, out=B)

does

$$B_{ijkl} \gets B_{ijkl} - A_{iklj}.$$

Some additional documentation (work in progress) is available at pytblis.readthedocs.io.

Limitations

Supported datatypes: np.float32, np.float64, np.complex64, np.complex128. Mixing arrays of different types isn't yet supported. I may add a workaround for real-complex tensor contraction.

Arrays with negative or zero stride are not supported and will cause pytblis to fall back to NumPy (for einsum and contract) or raise an error (all other functions).

Research

If you use TBLIS in your academic work, it's a good idea to cite:

TBLIS is not my work, and its developers are not responsible for flaws in these Python bindings.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytblis-0.0.3.tar.gz (25.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pytblis-0.0.3-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (5.9 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

pytblis-0.0.3-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (2.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.24+ ARM64manylinux: glibc 2.28+ ARM64

pytblis-0.0.3-cp313-cp313-macosx_12_0_arm64.whl (2.0 MB view details)

Uploaded CPython 3.13macOS 12.0+ ARM64

pytblis-0.0.3-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (5.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

pytblis-0.0.3-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (2.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.24+ ARM64manylinux: glibc 2.28+ ARM64

pytblis-0.0.3-cp312-cp312-macosx_12_0_arm64.whl (2.0 MB view details)

Uploaded CPython 3.12macOS 12.0+ ARM64

pytblis-0.0.3-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (5.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

pytblis-0.0.3-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (2.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.24+ ARM64manylinux: glibc 2.28+ ARM64

pytblis-0.0.3-cp311-cp311-macosx_12_0_arm64.whl (2.0 MB view details)

Uploaded CPython 3.11macOS 12.0+ ARM64

pytblis-0.0.3-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (5.9 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

pytblis-0.0.3-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (2.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.24+ ARM64manylinux: glibc 2.28+ ARM64

pytblis-0.0.3-cp310-cp310-macosx_12_0_arm64.whl (2.0 MB view details)

Uploaded CPython 3.10macOS 12.0+ ARM64

pytblis-0.0.3-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (5.9 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

pytblis-0.0.3-cp39-cp39-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (2.6 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.24+ ARM64manylinux: glibc 2.28+ ARM64

pytblis-0.0.3-cp39-cp39-macosx_12_0_arm64.whl (2.0 MB view details)

Uploaded CPython 3.9macOS 12.0+ ARM64

File details

Details for the file pytblis-0.0.3.tar.gz.

File metadata

  • Download URL: pytblis-0.0.3.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pytblis-0.0.3.tar.gz
Algorithm Hash digest
SHA256 54d8dd202b6edac840b629ea01a4dff92d21be81fea572bca35f2cf4b9b1a2f3
MD5 f38ad67ddaa7ab0d43416e081986b810
BLAKE2b-256 afde70acd5f4b3258d87c5268edc40dbff5d0e27ee5d39db9d54441a46945564

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.3.tar.gz:

Publisher: release.yml on chillenb/pytblis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytblis-0.0.3-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pytblis-0.0.3-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 59452bccefef5fcefaf537dbf112fd47d5022eabd43a141cd0c691041f7ce3ec
MD5 3bf7a5486f6b0b5c8c33a49009b0865d
BLAKE2b-256 8a68a6fe33f163deb761e1b4fa2b4662360fa09a2a2ea837147f5701b2dbcd74

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.3-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on chillenb/pytblis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytblis-0.0.3-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pytblis-0.0.3-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 be562d52098a3595a0598e8aba1b0797df86061921de3feec290da55845656b7
MD5 5a0de62a8fc498a311e801fe231b7bc4
BLAKE2b-256 4aa80730022ab812be53ab779feb1523918e79fff0b94e66eaf248c849cd6d78

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.3-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl:

Publisher: release.yml on chillenb/pytblis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytblis-0.0.3-cp313-cp313-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for pytblis-0.0.3-cp313-cp313-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 230ae3451d25cf6fa8e529b67c13d9369932b0e6ce51ceaab852ab7dd7c779d0
MD5 6b782c14b21229e0df47558a3e55ab03
BLAKE2b-256 c3457b288a4ddd8fd18bb3a5bbeab87073e85daab8cefc8f6a41a37b5b3608ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.3-cp313-cp313-macosx_12_0_arm64.whl:

Publisher: release.yml on chillenb/pytblis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytblis-0.0.3-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pytblis-0.0.3-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e23aae2dbbfd52a7a66ed379925824a1a9d0e23664ea13ec737c309374b86cff
MD5 5daf9cb21b16da8c41a86649ec9a6d2b
BLAKE2b-256 a52a1cb4faf560cdd10e7ecf2f9982befdcbc791e7f51f3b546e92c80130171e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.3-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on chillenb/pytblis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytblis-0.0.3-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pytblis-0.0.3-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0c54b9bc4672b0135fa62f507a65b6612993f270ae265e426919b52946c30813
MD5 b5bb271cbbd593c03cd399e9d7be8154
BLAKE2b-256 1bca51fecdf09844eb438da2db068d91ca1731d6611d187d1c2a52497ae38593

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.3-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl:

Publisher: release.yml on chillenb/pytblis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytblis-0.0.3-cp312-cp312-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for pytblis-0.0.3-cp312-cp312-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 dcf391ded2397bd6c7c253dae241eb25d22a0e5e13a17d41089c68cfa8134c1b
MD5 8842879529777571660ef00e1035ba6e
BLAKE2b-256 15f757a150b3bc480e687bc31483ff565093ae156061640843bb61d706bd7522

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.3-cp312-cp312-macosx_12_0_arm64.whl:

Publisher: release.yml on chillenb/pytblis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytblis-0.0.3-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pytblis-0.0.3-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 376e93cec61f22c5c133bb5d0c8f311d330d30e703d4915081eebbde4cebd207
MD5 4f612e2b2034696e3a91a7e7fcae92c4
BLAKE2b-256 2f4054550e6bb4382a6e2725e35a53869d8c6b9838d7fdc859ffe31cd36adf39

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.3-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on chillenb/pytblis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytblis-0.0.3-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pytblis-0.0.3-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 ccb48d6608e57d9bad246a2b8b4dff4873e93a71f4fbde1bfa8f1146c52c0ff0
MD5 184bb9ca663a2bb12cacc63c9f781205
BLAKE2b-256 dfbb4da2d5a7a08e6c76eca74f71caffffbf9e9a0b1dcefbb194256086194af5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.3-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl:

Publisher: release.yml on chillenb/pytblis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytblis-0.0.3-cp311-cp311-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for pytblis-0.0.3-cp311-cp311-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 e89fde446bc88127c5797afef75dddbc437b5f5c82880fe54593f1e9ce9079c7
MD5 c34ec3f6d0dc02cb9d648fe88c44f250
BLAKE2b-256 086f05641ea9e7e4a4ec61d9945d08ab48baadddad332ef2800d25603eb98ee4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.3-cp311-cp311-macosx_12_0_arm64.whl:

Publisher: release.yml on chillenb/pytblis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytblis-0.0.3-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pytblis-0.0.3-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2f16d023bdb23f0fa0311222ca0a9204597e978da55005e81d7f7d2ea1a2d94d
MD5 3c00079380484875446e2bdb5734c222
BLAKE2b-256 45e92d634a03284508a29f12290de0c23f10d088f8652d8600582411f2a41f16

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.3-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on chillenb/pytblis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytblis-0.0.3-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pytblis-0.0.3-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 3bda355e1436991ee68b54fcbfc901c0b2b8dfbb85607b27043420aa02457765
MD5 ab63da2c06bb7ecf0afd820e98333e9b
BLAKE2b-256 4c92b9ad4ad8d615238efc2853176b5d7b117ea79a365bd63890885c94975cd2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.3-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl:

Publisher: release.yml on chillenb/pytblis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytblis-0.0.3-cp310-cp310-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for pytblis-0.0.3-cp310-cp310-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 eabb37cbc57843fb749309e8f53992763d29bd0466e2c39a901eb94279e9a156
MD5 47c305416d63cefbde56d7301134c901
BLAKE2b-256 eba6f6f7df6c2bfc1685fb053d1585622cbc4f78f48174cdd7c709c0650ecb23

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.3-cp310-cp310-macosx_12_0_arm64.whl:

Publisher: release.yml on chillenb/pytblis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytblis-0.0.3-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pytblis-0.0.3-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a18f872c54c2f8851f074ee5a4b316ba6aaab66a4816b33d21dba838fe41840a
MD5 15ea26fd8829918b1c93758a05f9d7d3
BLAKE2b-256 41af0c3eaa7d9a1827fd9223be07124a90c0e14a7017ae149dfec2a35ab618a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.3-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on chillenb/pytblis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytblis-0.0.3-cp39-cp39-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pytblis-0.0.3-cp39-cp39-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b6fcabb37fe1fb43a8893ccd2bcb124316cc1dfc54820de1af03115475b12519
MD5 a489eb00d759a16de1e960c0cd0d75cf
BLAKE2b-256 c4da45a646743809d0298d85e0607b4ab117181d4cd56e6acba231b6f9c964a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.3-cp39-cp39-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl:

Publisher: release.yml on chillenb/pytblis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytblis-0.0.3-cp39-cp39-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for pytblis-0.0.3-cp39-cp39-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 a87ebdf4d936578a178a443293977b32f7cd1070ae61107eba9aa7ea8d900ced
MD5 1fe29525ce3ccf34d0a0b357feb808dd
BLAKE2b-256 21ac36d8fe50fa4ab1d17455a96a0e159f6498db4eb58fc4884dc429d2c978d7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.3-cp39-cp39-macosx_12_0_arm64.whl:

Publisher: release.yml on chillenb/pytblis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page