Skip to main content

GPU Accelerated Numerical Methods Library

Project description

GPUPy

GPUPy is a high-performance Python library for numerical methods, offering seamless support for both CPU and GPU computations. It is designed for students, researchers, and engineers who need efficient and scalable numerical tools for scientific computing.

✨ Features

  • ✅ CPU (NumPy) and GPU (CuPy) support with automatic backend switching
  • 🔁 Root Finding Methods (e.g. Bisection, Newton-Raphson)
  • 🔬 Differentiation Techniques (Forward, Backward, Central Differences)
  • ∫ Integration Methods (Trapezoidal, Analytical)
  • 📈 Interpolation (Linear and Cubic Spline with GPU versions)
  • 🔄 Linear System Solvers (Direct methods, LU Decomposition)
  • 🧠 Optimization wrappers (using SciPy)
  • 🧮 ODE Solvers (via scipy.integrate)
  • ⏱ Benchmarking utilities for performance comparison
  • 📊 Built-in plotting support for interpolations and function visuals

🔧 Installation

Clone the repository:

git clone https://github.com/yourusername/GPUPy.git
cd GPUPy
Install required dependencies:
pip install -r requirements.txt

💡 Make sure you have a compatible CUDA-enabled GPU and cupy installed to use GPU features:

pip install cupy

📁 Project Structure

GPUPy/
├── GPUPy/
│   └── src/
│       └── numerical_methods/
│           ├── core.py
│           ├── root_finding.py
│           ├── differentiation.py
│           ├── integration.py
│           ├── ...
│
├── tests/
│   └── test_root_finding.py
│   └── test_benchmark.py
│
├── examples/
│   └── root_finding_demo.ipynb
│   └── gpu_vs_cpu_benchmark.ipynb
│
├── README.md
└── requirements.txt

Usage Example

import GPUPy as gp

def f(x): return x**2 - 4
def df(x): return 2 * x

# CPU
root = gp.newton_raphson(f, df, x0=3, use_gpu=False)

# GPU
root_gpu = gp.newton_raphson(f, df, x0=3, use_gpu=True)

print("Root (CPU):", root)
print("Root (GPU):", root_gpu)

Benchmark Example

from GPUPy.src.numerical_methods.utils import benchmark
from GPUPy import bisection

def f(x): return x**2 - 4

cpu_time = benchmark(bisection, f, a=0, b=5, use_gpu=False)
gpu_time = benchmark(bisection, f, a=0, b=5, use_gpu=True)

print(f"CPU: {cpu_time:.6f}s | GPU: {gpu_time:.6f}s")

🤝 Contributing Pull requests are welcome! If you want to contribute:

Fork the repo

Create a new branch

Add your feature or fix

Submit a PR 🚀

📜 License MIT License. See LICENSE for more details.

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

gpupy-0.1.1.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

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

gpupy-0.1.1-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

Details for the file gpupy-0.1.1.tar.gz.

File metadata

  • Download URL: gpupy-0.1.1.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for gpupy-0.1.1.tar.gz
Algorithm Hash digest
SHA256 49396752ef73798b55a67cdbb54d892ca2a1d37580f7edfe1e8e9bb739739130
MD5 971fae02f3372f69e629dc1139c78a7f
BLAKE2b-256 d9ad8166f34ad1ab86568dc4a5bda14aa83ab8937e0a00bd60628e0d7034dd02

See more details on using hashes here.

File details

Details for the file gpupy-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: gpupy-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 21.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for gpupy-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7a127245f348cbf1f92832d6c4db863e7b40cf1f5506d1b1db75bf0ffd8e3b06
MD5 93b998cb6857af4393f3e8c37f2c6132
BLAKE2b-256 7d49ad174184883cc56d2a4d3f43073b08b3a4e4295b4e67f17ffae93d5b6762

See more details on using hashes here.

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