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.2.tar.gz (18.3 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.2-py3-none-any.whl (24.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gpupy-0.1.2.tar.gz
  • Upload date:
  • Size: 18.3 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.2.tar.gz
Algorithm Hash digest
SHA256 5f724804bf9af417a5d7d7c7973270184ab02370c72ab97422aa0b929302eac1
MD5 4425266b70c87a8e525562158b90cbbb
BLAKE2b-256 19c47a341dcefb2b6c83ecb7b76a46cc17bc6ea86c2f170015f6583e00414a78

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gpupy-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 24.8 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 37c8afadf74f204c7272ce996f98a4ca06947f179e40ef88ada216a64a8670c6
MD5 09054dd5cd9a0e9f791118731c817c92
BLAKE2b-256 6825f4b9315be272857249068951b277b6d30d84b220a8777a72e3563c5d6bff

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