Skip to content

vroger11/python-numerical-libs-bench

Repository files navigation

Python Mathematical Libraries Benchmark

A benchmarking suite to compare the performance of different Python mathematical libraries (NumPy, JAX, PyTorch) across various operations.

Overview

This project provides a comprehensive benchmarking framework to evaluate the performance of different mathematical libraries in Python. It measures execution times for various operations (element-wise operations, matrix multiplication, gradient computation, FFT, and sorting) across different libraries and hardware configurations (CPU/GPU).

Features

  • Benchmark multiple mathematical libraries (NumPy, JAX, PyTorch)
  • Compare CPU and GPU performance
  • Test various operations: element-wise operations, matrix multiplication, gradient computation, FFT, and sorting
  • Generate high-quality SVG plots of the results
  • Customizable output directory for saving results

Usage

Run the benchmark suite with default settings:

uv run main.py

Specify a custom output directory:

uv run main.py --output-dir my_benchmark_results

Benchmark Details

The benchmark suite tests the following operations:

  1. Element-wise Operations: Addition, multiplication, and sine functions
  2. Matrix Multiplication: Small and large matrix multiplications
  3. Gradient Computation: Computation of gradients
  4. FFT: Fast Fourier Transform
  5. Sorting: Sorting algorithms

Each operation is tested with both small and large tensor sizes to evaluate performance across different scales.

Output

The benchmark generates SVG plots for each operation, showing execution times for each library and hardware configuration. The plots are saved in the specified output directory.

License

This project is licensed under the MIT License.

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages