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.

Acknowledgements

The implementation of einsum and the tests are modified versions of those from opt_einsum.

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.8.tar.gz (26.9 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.8-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (6.0 MB view details)

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

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

Uploaded CPython 3.13macOS 12.0+ ARM64

pytblis-0.0.8-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (6.0 MB view details)

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

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

Uploaded CPython 3.12macOS 12.0+ ARM64

pytblis-0.0.8-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (6.0 MB view details)

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

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

Uploaded CPython 3.11macOS 12.0+ ARM64

pytblis-0.0.8-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (6.0 MB view details)

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

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

Uploaded CPython 3.10macOS 12.0+ ARM64

pytblis-0.0.8-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (6.0 MB view details)

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

pytblis-0.0.8-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.8-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.8.tar.gz.

File metadata

  • Download URL: pytblis-0.0.8.tar.gz
  • Upload date:
  • Size: 26.9 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.8.tar.gz
Algorithm Hash digest
SHA256 e22b71245748f605d9aab9932cdcc410ba3efdee27e66f4540b07623ad013098
MD5 10fe6498d1d1b81bb8de4e4fcc1dc7ab
BLAKE2b-256 bebe8df35590bcab30f13abd286a1ebf015f745631160f62af90656984176742

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.8-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ab51b7b45013f64f94b54f20900fe7a5767134bf25c26b75b23a7cfa472eb04d
MD5 e12442f9512a0ad9a57ddd6c3132ced1
BLAKE2b-256 c1afa7fc1595e517051f34fbeb4291cdafc428472d070aff6e350c127d5bad84

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.8-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b642ca758a2b11e37c5b7c16450f75a9f5c136380056eb011db079e6f99b99b4
MD5 f8a718ae76b64a31f364b47cf3537faf
BLAKE2b-256 58fe35697076573efa0618fa3dd33d4790bd2b0059e4f2fdea43b3b135347b55

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.8-cp313-cp313-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 de94ca2c976a3de6bcb61d406491bd6cb7baf1cd435a688e6206fec6701cc901
MD5 d458375848aba41104a7dc7384dc9da2
BLAKE2b-256 5505c6b29ccb72f6a083d5454ea45b69c23f0b63f5ca6bf3ebbeffc0018b3012

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.8-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7ab9c075e654406c52bf8d926a0cf37f42735a1575066e91ffc744b99fb4e1a3
MD5 740d0c03c675726edce165bcae837f17
BLAKE2b-256 c930bcfb6f33fc5582ec82dffa361fc322b10ff8533ad9de4f5804ae193d8679

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.8-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b7f14fdbed912432999499e84571ad4627a55b85a195b7b50f92c8fea131f16b
MD5 4adb01243c3cd8ab7cc4f3cd410e5f80
BLAKE2b-256 997d5840dca223b6d6a80189e90de29a51b5b29b3fe5b60c2ef76d79058c5865

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.8-cp312-cp312-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 10fd123b9d1035c5e65be3c41aa3fcc180d5c1b2d2de74662cfab7b109107a2e
MD5 0310cb98cb614c70ac0c8845d230bfc6
BLAKE2b-256 a4c4cd59c5ccda67108d232aed013cf0afa7849817c70b719d7adf759b71c2c3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.8-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e2890b8ac9ec48526e74c8fbc203baf1cd7dc5a79638b9201be4cbdddc9125c8
MD5 40aa4e3b69f1824c6118c88aa0697542
BLAKE2b-256 23ace5ed436a3ea9d2d0a72923e76617c48ed21d2cdd57e9b452512591688aab

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.8-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 6e26da38d2a62844b69d47724ba328bf0bc8d0736510b065d522373152eaa070
MD5 cb606985aca6b69bcb8a635d1e806abe
BLAKE2b-256 0063fbf49ecbdff27adab0b6ea6995b6681bb0e1bc3eae2ce517ac9f8126cedb

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.8-cp311-cp311-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 d4f5d7034ec27e996fcda35b0469e2aafe8f5f30febffa310da366456e84f7f5
MD5 b2076080bbed9872df0109051e61f49f
BLAKE2b-256 f3fe029a2eb870f0dc8e8780ad157447a5042787f602f2c869450b0fa5d9a2f2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.8-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d8d52e5d956cfe5adcf10e099f93ea410f9b4221cf39534dfe0a6ebb7cefd82e
MD5 053726b0cbd2da259bef97725a85f797
BLAKE2b-256 c91575b9c6ef34e730220d8fc2f2277df657875cde5ac17d8ee235ab758b1003

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.8-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 be171c4a8d3e27e2f3ccb5f2574a4441e4b918c1d9a8746b198d721a1a6f0c47
MD5 449f40099d552cef294cab654d9d0d11
BLAKE2b-256 04f3c5f114976d4059ea72404c8c6ea722400b1e2eae6dddccde695d788e8d6b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.8-cp310-cp310-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 551cd5579da890eed75cea5db7017a54019861a85acbcf271baf9f6ba62d7761
MD5 0a38b086ccf767a4b45f2f2ace333898
BLAKE2b-256 11d1ab23bfda073699e36a9acdf12582cebe2341937377250adf6453ad5c969b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.8-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 efdc21665ab76341a0ddcd3e908dc8af35c00d5f1161c467595ab549e47ca92b
MD5 be3462cd4380eaf4177de7e466e03d99
BLAKE2b-256 e98a7aa18b931457fd9d44d2dd70c276c3cbb2bc0765962d2b445bf232da731b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.8-cp39-cp39-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 62daf39c98c3c0bc6248627f8008d6326732348474a32d52a7a2f53d482806bc
MD5 af6363617f3a30296a5ad88d9fe4b07a
BLAKE2b-256 a3182fa4d6bb3aa77ee1f40641f4ad49d49231953dc39eae588a5a208a69288a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.8-cp39-cp39-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 94463ecf1a12ef3fc0585c21236128b125cc0ba53979d5088424a355afe7f174
MD5 238f7426cd1499dfadaba756dd91ab0d
BLAKE2b-256 f09ed7bb2a66e2de113fe57f8e3970d4e95f6892fae67746e72690c15dffcaba

See more details on using hashes here.

Provenance

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