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.0.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.0-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: unpu-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 be6a8ece28b5e217555e3743eed77e3779ee08a26c7b31943dcffd4d9131dd58
MD5 2f8e98acc7699b573901959d00819f18
BLAKE2b-256 098c4ffc0061d8c7acb531a4eb319606b8912dcd5c51de29265cd32e2abcb8c6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: unpu-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 82dd7f6751ba63ed2122c7514725f932534dcfde66b1f22a8ee0dbc5ebfcdefc
MD5 f987b7f1d5ac2283b9cd6a2795b22466
BLAKE2b-256 a2bda4b41bc105ae5c9c11292578244be69ad28842d03685fbda126f1a704d73

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.2

2 files

This release

0.1.0 This release

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