Skip to main content

Markdown

UNPU (Universal Numerical Processing Unit)

UNPU는 NVIDIA GPU(Triton/CUDA), Intel XPU(Arc/MKL), 그리고 pure CPU(NumPy C-BLAS) 환경을 동적으로 감지하여 최적의 연산 파이프라인으로 실시간 라우팅해 주는 통합 가속 및 메모리 관리 라이브러리입니다.


✨ 핵심 기능

  • 자동 하드웨어 라우팅: NVIDIA CUDA, Intel XPU, CPU(YPU 타일링 연산)를 자동 감지 및 지연 시간 최소화 실행
  • PyTorch & NumPy 교차 연산: torch.Tensornumpy.ndarray 입력을 구분 없이 한 번에 가속
  • 통합 메모리 스위프: Context 종료 시 VRAM 캐시 정리는 물론 fasthardware OS 가비지 수거 및 WorkingSet 회수 자동화
  • 실시간 추론 전용 KV Cache: 엣지 디바이스 LLM 및 시계열 추론을 위한 최적화 메모리 버퍼 제공

📦 설치 (Installation)

# 기본 설치
pip install unpu

# Triton 및 외부 메모리 스위퍼 옵션 포함 설치
pip install unpu[all]

🚀 빠른 사용법 (Quick Start)

  1. 기본 매트릭스 연산 (Matrix Multiplication)
import torch
import unpu

# 하드웨어 자동 디바이스 감지 및 Context 진입
with unpu.UNPUContext() as dev:
    print(f"Active Engine: {dev.backend_str}")

    a = torch.randn(512, 1024)
    b = torch.randn(1024, 2048)
    
    # NVIDIA Triton -> Intel XPU -> CPU YPU 순서로 자동 라우팅
    c = unpu.unpu_matmul(a, b)

Context 블록 이탈 시 VRAM 및 CPU WorkingSet 자동 Sweep 수행

  1. NumPy 배열 CPU C-BLAS 가속 (YPU Engine)
import numpy as np
import unpu

a_np = np.random.randn(512, 1024).astype(np.float32)
b_np = np.random.randn(1024, 2048).astype(np.float32)

# NumPy C-Contiguous 레이아웃 변환 및 BLAS 가속 연산
res = unpu.ypu_matmul(a_np, b_np)
  1. PyTorch 가속 레이어 적용
import torch
import torch.nn as nn
import unpu

class EdgeModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc = unpu.UNPULinear(1024, 512)

    def forward(self, x):
        return self.fc(x)

📜 License MIT License

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

unpu-0.1.2.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

unpu-0.1.2-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

Details for the file unpu-0.1.2.tar.gz.

File metadata

  • Download URL: unpu-0.1.2.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for unpu-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c9a65d7249e1f916fbd327eb45977c8cab61e80fce4768901bf6ac327ccc238d
MD5 dc2d3a878e058dcf9880cf575e4cb09b
BLAKE2b-256 e0f177de64944e569302f83166a14ddf1561affd952904129d3a75fac96391b6

See more details on using hashes here.

File details

Details for the file unpu-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: unpu-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 24.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for unpu-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 37371d87ff0360e0362a23a84713bcdcd897d7bdab48b759a48d4a824da3054c
MD5 5338267c716cf94f620d43b78d919a0a
BLAKE2b-256 d75e2fa49a6c78c515062090d104cdb1b46f815d34cf1db988e4d5ccda1e6638

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 files

0.1.0

2 files

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