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.5.tar.gz (25.2 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.5-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (6.1 MB view details)

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

pytblis-0.0.5-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (2.7 MB view details)

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

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

Uploaded CPython 3.13macOS 12.0+ ARM64

pytblis-0.0.5-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (6.1 MB view details)

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

pytblis-0.0.5-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (2.7 MB view details)

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

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

Uploaded CPython 3.12macOS 12.0+ ARM64

pytblis-0.0.5-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (6.1 MB view details)

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

pytblis-0.0.5-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (2.7 MB view details)

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

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

Uploaded CPython 3.11macOS 12.0+ ARM64

pytblis-0.0.5-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (6.1 MB view details)

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

pytblis-0.0.5-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (2.7 MB view details)

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

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

Uploaded CPython 3.10macOS 12.0+ ARM64

pytblis-0.0.5-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (6.1 MB view details)

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

pytblis-0.0.5-cp39-cp39-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (2.7 MB view details)

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

pytblis-0.0.5-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.5.tar.gz.

File metadata

  • Download URL: pytblis-0.0.5.tar.gz
  • Upload date:
  • Size: 25.2 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.5.tar.gz
Algorithm Hash digest
SHA256 d39b29d92b79e8101992d0d00af6df2b2cff12b806b1b010dfbdb3d703711cc2
MD5 7732f65a383a9005229f446d788251f5
BLAKE2b-256 f8f507954055af7f1f98aa86641a0bce30d272e98469694abfe16e64c1b4192d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.5.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.5-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pytblis-0.0.5-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a54f89e33b248a9be6a8803f124cff6bbdb4bd3abba149143189e4e5f0ff7659
MD5 e4f13d5c9c23ffc10dc758634b35dcd5
BLAKE2b-256 502e05c7cad54cfdc5e0549b0edc2ba69444186b9808c2c7c47d4f37aa8a336d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.5-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.5-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pytblis-0.0.5-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a4908940783a5e1661d83dce70bb3a60850a5d01b1fe9380fdca238abcfaecaa
MD5 7670ae011b44917ec59afaf19d13f323
BLAKE2b-256 e07a4ba35d44edca8f4222eb3354237933c72c87682feabbd18c349df0bfa461

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.5-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.5-cp313-cp313-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for pytblis-0.0.5-cp313-cp313-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 0c2d4cea1c8cdc376505d7c6875bf0aac440045530bc733b2c35b6ab6839d434
MD5 956f79310ef1790ea712cdf7a22edba1
BLAKE2b-256 14a36eac03707e7b509621dc913dba493e00635a04f29522ec689e1829ac0bb0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.5-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.5-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pytblis-0.0.5-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 dbd3450468bdb1f50597ebef9b3c863ad703a9d3ec98ba2eb4b3a812777450ff
MD5 86018732fc2abc0056133ed84a9d0123
BLAKE2b-256 d14bb855a7ae02a86caa72a65953cd57b60b0ba7ede539d42c7c7baa6226f3a6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.5-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.5-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pytblis-0.0.5-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 8a3a11a669eeac0a6bf1533369d2f1b2294652107a33541992955796e397d868
MD5 e49b9f6d0263358393a9f075763efb44
BLAKE2b-256 d33e5fb77f4da1b03e3f43d64fb7a8e4c424c85f4213efe74abe37b2f8c0293d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.5-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.5-cp312-cp312-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for pytblis-0.0.5-cp312-cp312-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 af79ea1f387ef33ad1651398a2be012420072db26d6e07229e07805f55eb3f6c
MD5 32b3e0c28d33dc4c68081ecc2a598cb4
BLAKE2b-256 f59e47199bbac707668d965c3c21981f965a23e0b9e5178c720052f44028ec27

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.5-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.5-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pytblis-0.0.5-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6bc9cd6773a921ff7d5de8acf44187f37a1b1da838055805e8248d5e56a5da4a
MD5 ee7a914d0608f227812b137760d4c155
BLAKE2b-256 a4286a150b56e3e1f36228b157b3c96e80dab7a9f9af5833a10a71f10fda4cda

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.5-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.5-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pytblis-0.0.5-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 603a14f676f69c73a1a36be3d89911a27a92bf9069f99e87104bfec3fc15e821
MD5 fde138c03c9c909d1abf86096c7bca9a
BLAKE2b-256 9e9742d06273eb7c48c3efebccb4e4d8305810a2ce9c64b2b6686f1e68bb9676

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.5-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.5-cp311-cp311-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for pytblis-0.0.5-cp311-cp311-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 1514e67e47738419bbd3bbb702cd5689bf3cdc00bc84372fc416ff634896df6a
MD5 1db62ebdd7c1622f0dab5e699ccdf366
BLAKE2b-256 5500c04db96239dff448c477e6faa4d1c7b9e88b1c3cc2b5189ce8d2edc97c89

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.5-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.5-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pytblis-0.0.5-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 13afba6e38ec05359434aa146c9bdb1b4559e3632cb8997b06ede0b0b0398655
MD5 45edb135656d1701852798e0d7060ef5
BLAKE2b-256 b36fac337d2f9b6c2a494d9e1a47afab7be55006f24274759fb82545672ac94b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.5-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.5-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pytblis-0.0.5-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 40bc1dec5da09603a7962a737d0b15f1047b7bfceb0ab60d3632693a7f79fa80
MD5 3f88b0c4e2be8cc3e481e0bbcfa038a0
BLAKE2b-256 44e272421a4b28fcb68e4d0037bfdb8f646dd8460bacb054f6316364619872aa

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.5-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.5-cp310-cp310-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for pytblis-0.0.5-cp310-cp310-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 9d7e2d9e5163dc308ba03d05471cd8604b0b32b3b085dad823a597b5808c8c86
MD5 4c567e78e3ef15b94698ef6a9bbeced2
BLAKE2b-256 1d707ad00e3f7c64220ac3ab8b770a781b27592530134ba723ec50e66cecd265

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.5-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.5-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pytblis-0.0.5-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c32e7450f40d68648f2dcc09a007f4c112761f4bd9f9366b48e0319db4a9ddc3
MD5 8aea02370dee00c6f2a922e223d8705c
BLAKE2b-256 f0b37902173b13e09463585cdb66c284aa69edf273a44ecfe0e1be2a7560bf4b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.5-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.5-cp39-cp39-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pytblis-0.0.5-cp39-cp39-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 56b2af3a2f3851467e409d0e27fe6fcd11cf31492effb2366349077919bb9644
MD5 dd0e5413b1f0d154f55865d1810fb052
BLAKE2b-256 254a76ccc0af6fadab291f42acbbb6f75afeb0d819c30d4cb818b2bca0e44fc8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.5-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.5-cp39-cp39-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for pytblis-0.0.5-cp39-cp39-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 6fa97341ea8a2e085562ddbec702ac9410257ea426e19a39d213bd1f7571b0e2
MD5 1cc88d4de75c8c7ece74a8d2fac62fb3
BLAKE2b-256 56a0f993a1e2f981c5517c4663b7c64919bac6a8c62636cd0a2af937c7618d61

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytblis-0.0.5-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