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.6.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.6-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.6-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.6-cp313-cp313-macosx_12_0_arm64.whl (2.0 MB view details)

Uploaded CPython 3.13macOS 12.0+ ARM64

pytblis-0.0.6-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.6-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.6-cp312-cp312-macosx_12_0_arm64.whl (2.0 MB view details)

Uploaded CPython 3.12macOS 12.0+ ARM64

pytblis-0.0.6-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.6-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.6-cp311-cp311-macosx_12_0_arm64.whl (2.0 MB view details)

Uploaded CPython 3.11macOS 12.0+ ARM64

pytblis-0.0.6-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.6-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.6-cp310-cp310-macosx_12_0_arm64.whl (2.0 MB view details)

Uploaded CPython 3.10macOS 12.0+ ARM64

pytblis-0.0.6-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.6-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.6-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.6.tar.gz.

File metadata

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

File hashes

Hashes for pytblis-0.0.6.tar.gz
Algorithm Hash digest
SHA256 b291144dcc9a63a401eb7a923ac3933dd4315a7fc00477bfdb4feda1c5ec60f7
MD5 9e0476b2f5626e7af30424a2d1dde4cb
BLAKE2b-256 9ac796a2b23b366b2343a3ddc1dca31862615383c01a4e1231305c8236e3209d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.6-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 552f22c77a99a5b85dce46dc2171fe1091e587c86b9f34e29dae65451ae882a8
MD5 7b7f38c962df64d2d8da9a0a56db0e27
BLAKE2b-256 20563dc1a1a183de20e692c3a88e5d07ddec704adddeee9c85b8ee38147c50c8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.6-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 5dbf14e353ebadde93954d77ebfa0aba118fde1c3f4894ea6c1139498cef8aa2
MD5 d578a47833e9908cde5e445d6d8fe7e7
BLAKE2b-256 56f8382878841a1da21487c3c689f5ac6cfc7c60dea12ada1e383a22c5c69892

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.6-cp313-cp313-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 16a18f113bf2cdae37b2e82fb80f4e99405fdca8362c1e767094c9757dfdc93b
MD5 7fcb34e1b3fb5e4ce2a8db5d777437f2
BLAKE2b-256 26cbb8b6404d950057e34bdea97e6ade4658ef878481994a5d34bd5933f55aff

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.6-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2c2f730b9f1021d288daf678e66f7dbd8d7ba24280dfafb439bd8f9f1f01c6eb
MD5 f21a0b5c6a331286df7e9cf53b6d7ff2
BLAKE2b-256 128b7dd4c65fd0a3281f956a26243d059c43d59ae7595b79fa406442bf98c2c0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.6-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 cd9db391d4bc91ad20bab750e5b3d3bb3372e364fea84787d05997c601d68c5c
MD5 e400d2bc263eb14c7877d7df56e1b806
BLAKE2b-256 6cdeb2369e12c8999fa21f2c3d955d0e3f56eb047e7ed99aef2b9a62ad41bcf6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.6-cp312-cp312-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 d9a1463d10536da61b946fd207c2c8f6d23e1a4e2eb067fd931b6807ad792153
MD5 508c7cef11796e32eee12643734891ac
BLAKE2b-256 2d8f94662082a5ac479b0531368235f5ed3b194738516de7b31b164e6b6c7729

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.6-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 83c7a384d0116ade3c5adc55be6fa6f1b167e3d89cddb76f06258d0fe4ed3d4c
MD5 0b275277adab275ac00bb716c2d0eb7f
BLAKE2b-256 9a73ab3ce3908bfcfe9a977f67f05df7011ef3e29ce79620ad6b0f2e7fe391b5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.6-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 199d3fd727be21e54b5e27a9d54722857553c084f791020a255d29c781769063
MD5 d23e437214cd7cfd103be152e019d826
BLAKE2b-256 60bdb3929f628a64307ffc1d4b55ea4133aef1544a3216688b8408d9aa1650fc

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.6-cp311-cp311-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 34b3cf121e9913164068fe4941109bc6b4b52627d7a8fdb37828e1654151ea0e
MD5 1bd445c58f82add7f2bc9740721221b0
BLAKE2b-256 26fc73c3e0d3fc1f401e69846f00272543f0b27ff9bd95c342e9169b0c93d445

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.6-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ea7e3c1fde1b98cce1f1f1f22b952c360a5949bec88a6eb1361492ac6b7f35e5
MD5 effc1d753d2fcf42b0bb6d7b22019194
BLAKE2b-256 9812768e825c278fbed1cec35101b41ecfb1938d2bb6ab22d4888c2559c1889c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.6-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 cbb2f789d45be7811b58d1a31bf56699c922ee5537cac08fdb39b9723d521007
MD5 814576dbf230f019af3186fd283081b9
BLAKE2b-256 0f19fb3cf816c8619caa3e0c67b7c9dfc966f460b8f3274755d6d84e18e86e6e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.6-cp310-cp310-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 15c41b47534f753f68ccea395dffcdf3e2a25f05d5d8071eed177bf3d290ec99
MD5 ed57956b64b4dbd2c6162c6db0893a7b
BLAKE2b-256 785ead96e35a2313b8914f850e6792b8e92f57f8dc223c65fe717dd915336db9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.6-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5879540f7d21c452a055f91d2016d0ed5297798f13138ba14bdb9cb4d73cd524
MD5 3ad2cd1e35262435fff3eb33fc352afc
BLAKE2b-256 2a47f791d601ac93aee6f494031c4534a57195b392b84cf9b8cae77470855936

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.6-cp39-cp39-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 9d09a1684ebf955f4db5c6a82bee24e4a2126a3918f1068a6610054aa18ee7b1
MD5 8e30e7d66fcceeebc1a930988ecf36b4
BLAKE2b-256 52907cdb887be9b1b0a3c8a9094e3da195c7cb698b39f0e76ec3379dfa308550

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.6-cp39-cp39-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 3ea10683452b94037d57ad6e44dc7981dd5afb8969fa910d55db04bd5c5edebf
MD5 dee192091c30f89388143fd163f22fa6
BLAKE2b-256 02fb12269ae0db2f6ed2668d1a8e11e14de00271f7118e3882b3f402d0e00107

See more details on using hashes here.

Provenance

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