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.0.tar.gz (15.7 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.0-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gpupy-0.1.0.tar.gz
  • Upload date:
  • Size: 15.7 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.0.tar.gz
Algorithm Hash digest
SHA256 686812ccf9254745d29b370cf18bb487c8844f45dcbde2de604153a230e6ff71
MD5 6b08dcfec5ee43dd937de368bccabd69
BLAKE2b-256 088e8e7a8259a221d0a1ba8dd51b022ad634328497f78863958c075444c6932c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gpupy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 21.9 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 da73b41a5754b71d50d16b48120ba66661075287df775b7fd4d0936883d77757
MD5 96b75121379eed7a0467bfa77a1e60b0
BLAKE2b-256 92cbc53e2d53a4fe09ebccf9be9cdd0192478a8c51f721f004cd9867a0700007

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