Skip to main content

tikos-utils-os

CUDA Batched Tensor Operations (tikos-utils-os)

A PyPI package that leverages PyCUDA for memory-efficient, element-wise tensor operations with unequal dimensions (multiplication and division) on NVIDIA GPUs.

This package is designed for large tensors that may not fit entirely in GPU VRAM. It processes the element-wise operations in slices (batches), ensuring that memory usage remains predictable and constrained. It implicitly handles broadcasting rules similar to NumPy, padding smaller tensors to match the shape of larger ones during the operation.


Installation

pip install tikos-utils-os

Note: This is a placeholder name. Once published, you would install it via the name you choose on PyPI.

Prerequisites

You must have the NVIDIA CUDA Toolkit installed and your environment correctly configured for PyCUDA to function.

Usage

Here are examples of how to use the multiply and divide functions.

Example: Element-wise Multiplication

import numpy as np
from tikos-utils-os import multiply

# Create two tensors of different shapes
tensor_a = np.random.randn(500, 10).astype(np.float32)
tensor_b = np.random.randn(160, 12800, 640).astype(np.float32)

# Perform memory-optimized multiplication on the GPU.
# The 2D tensor 'a' will be broadcast to match the 3D tensor 'b'.
# verbose=True prints logs and timing information.
# slice_size_mb controls the VRAM used for each batch.
product = multiply(tensor_a, tensor_b, slice_size_mb=128, verbose=True)

print("\nMultiplication complete.")
print(f"Result shape: {product.shape}")

Example: Safe Element-wise Division

import numpy as np
from tikos-utils-os import divide

# Create two tensors
numerator = np.full((100, 200, 300), 10, dtype=np.float32)
denominator = np.random.randn(100, 200, 300).astype(np.float32)

# Introduce some zeros into the denominator to test safety
denominator[10, 20, 30] = 0.0

# Perform safe division. The kernel ensures that division by zero results in 0.0.
result = divide(numerator, denominator, slice_size_mb=64, verbose=True)

print("\nDivision complete.")
# The value at result[10, 20, 30] should be 0 because of the safe division.
print(f"Value at result[10, 20, 30]: {result[10, 20, 30]}")
assert result[10, 20, 30] == 0.0
print("Verification successful!")

Metadata

Release files for tikos-utils-os 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tikos-utils-os 0.1.1
File Size Uploaded Provenance
tikos_utils_os-0.1.1.tar.gz 14.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for tikos-utils-os 0.1.1
File Interpreter ABI Platform
tikos_utils_os-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 29.8 kB

Release files / tikos_utils_os-0.1.1.tar.gz

Download URL tikos_utils_os-0.1.1.tar.gz
Size 14.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5d412cd466580cd28334c6ce61399aa101c858ca0166fece8468dcbb4f1ef26c
BLAKE2b-256 checksum
How to use checksums
7af4b3814bee481ccc041348882b887f9dcf2f84a8effa80135dc32f5b9196f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.9

Release files / tikos_utils_os-0.1.1-py3-none-any.whl

Download URL tikos_utils_os-0.1.1-py3-none-any.whl
Size 14.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
75104ba1ec68caeb51402f01d7e17912a771493b57ad5e95ba6cfddb4813fdac
BLAKE2b-256 checksum
How to use checksums
332fe2201ccaa384b33d5fd56a1066d5aa12e90e180242c6dab5d47219869ec7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.9

Security for tikos-utils-os 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page