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

Uploaded CPython 3.13macOS 12.0+ ARM64

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

Uploaded CPython 3.12macOS 12.0+ ARM64

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

Uploaded CPython 3.11macOS 12.0+ ARM64

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

Uploaded CPython 3.10macOS 12.0+ ARM64

pytblis-0.0.4-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.4-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.4-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.4.tar.gz.

File metadata

  • Download URL: pytblis-0.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 d05b95a62bb3731b0cd3360bb68957de52bdf063bc85a0057a397e7241e8d5f2
MD5 2fc5bbdacb5a675fb9a41bec327056df
BLAKE2b-256 27d79ca88c322754516b5d108b88b4a27d445aba41f2ab9e93ea910672b36e49

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.4-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 76e6ee4f295dcbb3e07526801603a4cc14b085af06c0980fe42db24ef0e854f7
MD5 b3217fed5713033f87366d3f10f5ac20
BLAKE2b-256 471d127e2ac20b8d8b0285d74af4b21030dfad027d079088f49c203a5c9afb44

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.4-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 cc2363fd7918e5b5378b6c1989aab9190831e6867e4964ba606fabf60baa383b
MD5 92ae34d4f597e463692c7aecd3b054ed
BLAKE2b-256 60a99bea250015a6089542112baab2709c725d2f5d8fcca29fde732f0461b047

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.4-cp313-cp313-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 504085b49fe149f27b90a3bf88c35a948b36092623dbc5233f905f0d34aa2485
MD5 f7151208b903f4694657b6738d770068
BLAKE2b-256 d39a782fc3dd9bf95a63c5b7a3ce7a2631734ef07e3f4a925b2c15530f84c221

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.4-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8f3dca333d6e512e887bca46c680734d537ee9e737151ea79907566afe652fba
MD5 f33d59ac01a4bc2c61ccfe4c8a68823a
BLAKE2b-256 589fdce409f3edc52fe39c8b60bf8beece936faa28409c2876c18b0af59731f4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.4-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 5bc12fc4f81f8cde86ce3fba4d7f6fab950ed2ba80024fe875f3ee1deb48cca1
MD5 bcf9e5ea3a9f29d32d21925b55050121
BLAKE2b-256 5edf2ea7132e048ee9c85c9107cd68a4343328e1edaf3c51db331b69217c475c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.4-cp312-cp312-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 f5001c9f4ce5885a235d15a2dcaea497d975a6a033c1caf34e5af28ec6d45c40
MD5 edff443bc511a9c67eeb5c8fedad4198
BLAKE2b-256 f5fdf3b565a46cb9130442faef6aab77e4e628128973b8f366490d6a192ca5c9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.4-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1a68fafe45c313a25ee42e9ef641cb957a5d19d606c42f96a7da439f392f7abd
MD5 7e1898241287a640de3a649d74ff03de
BLAKE2b-256 5f0a85d9cda481654c6c12503bbd6db8611d6496ef2e587377b6174c8ed6a59b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.4-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 388a7485755aa757f07bef080384313a0ae8eda059f08234023d94aa36793814
MD5 291249b9de62e602d741ad80e8f35291
BLAKE2b-256 1cc5b95e3f59978796c390f3a511dceca7ff116f860a26870bae92515f20520a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.4-cp311-cp311-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 dcc0f273f8c29a0e743dbd7c41b3326a8b889dbf39a7aad2c8aa4579114e3d47
MD5 68066f3565f93fb33dd25a24903d1412
BLAKE2b-256 d90ece938062a1718032bd20a56bd221aa0577f768c96e525fc7b39cc897b68a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.4-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9f37d54faf024f85884db42080eacc4f54b23a4f4922e73424c9b18f40253148
MD5 3b0097ef964a420bdb5016da3d4e41ae
BLAKE2b-256 d663cf85f77546d2c7f9e44d0b744a587d5ac352d56f195d3ead6821729f4b56

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.4-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 5828f6e225f42d1a8d5a97df22b8798df70bc88450ebdca5079283f7258d7d85
MD5 e72e08a0e8281dff6953dbf8a5d0f2b5
BLAKE2b-256 c984859e77cd2b4598177edce2f29ec285ea688ebe030fea8b21d770d12c59b2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.4-cp310-cp310-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 a0fb0bcb308631ac7b7ce9070388a0d287536550c3c9bd65483fc7a2767026ef
MD5 e466c8ccbc12d7616bdedcd3281a45fe
BLAKE2b-256 1d8e6352dcc77cfe1e607530ffd5268a4f0e45b53904632bd15b6d5afd1ad236

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.4-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6d4072fddee21f90f902efc038e77cc20ad3795e247972fcde48236ccbb79bcc
MD5 c33ebb8e78fee1191a5dd4b34e482460
BLAKE2b-256 be1d1ffac52abd832da29dec1ab741f0bdbfd5393730544fe38ce27814ffdec9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.4-cp39-cp39-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 5b320d4aa2e78512e727076a385ed56ffdfd689cbc17ee8cd572ea808fe9cdf2
MD5 75dc1b278537d323fee4c899ef5df1ef
BLAKE2b-256 30859f9a6c7e1fd3aafb914358c9b4229414d03b15b15191a8f28827ec53f64a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytblis-0.0.4-cp39-cp39-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 cedb24cf4b5cef75829bba3014d2305471d1ace65d9584a83f4a61b62324cfa3
MD5 24def6891a97e7d34dc1fdcfc7f0c7b8
BLAKE2b-256 13647fd4dadf3ccc01f06c30f750bafe8576db4a1d94bbe56789db82948e9997

See more details on using hashes here.

Provenance

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