Giter Site home page Giter Site logo

ahmad-alkadri / curious-julia-numpy-matrix-solver Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 5 KB

Repo created as exercise and out of curiosity: benchmarking Python's Numpy against default Julia matrix solver

Home Page: https://ahmadalkadri.com/posts/matrix-solving-with-julia-and-numpy-as-comparison/

License: MIT License

Makefile 37.80% Julia 21.19% Python 41.01%
benchmark julia matrices matrix matrix-solver numpy python

curious-julia-numpy-matrix-solver's Introduction

NumPy and Julia Benchmarking

This repository contains scripts to benchmark the performance of matrix equation solving (Ax = B) using NumPy (Python) and Julia.

Overview

The benchmarking process is divided into three main parts:

  1. Matrix Generation: Random matrices and vectors are generated using NumPy.
  2. NumPy Benchmarking: The numpy.linalg.solve function is used to solve the equation and its performance is recorded.
  3. Julia Benchmarking: The \ operator in Julia is used to solve the equation and its performance is recorded.

All the generated matrices, vectors, and results of the benchmarking are stored as .txt and .csv files respectively.

Dependencies

  • Python 3
  • NumPy
  • Julia
  • Python memory_profiler library
  • Julia packages: BenchmarkTools, DelimitedFiles, CSV, DataFrames

Directory Structure

  • matrix_generation.py: Python script to generate matrices and vectors.
  • numpy_side.py: Python script for benchmarking with NumPy.
  • julia_side.jl: Julia script for benchmarking with Julia.
  • Makefile: Automates the setup, matrix generation, benchmarking, and cleanup processes.

How to Run the Benchmark Tests

Ensure you have Python 3, NumPy, and Julia installed on your machine.

Step-by-step Instructions:

  1. Clone the Repository:
git clone https://github.com/ahmad-alkadri/curious-julia-numpy-matrix-solver.git julia_numpy_matrix
cd julia_numpy_matrix
  1. Run the Benchmark Tests:

Use the provided Makefile to run the benchmark tests:

make all

Explanation of major Makefile targets:

  • genmatrix: Generates matrices and vectors used for testing.
  • numpy: Runs the NumPy benchmark.
  • julia: Runs the Julia benchmark.
  • combine_results: Combines the results of NumPy and Julia benchmarks into a single .csv file.
  • all: Runs all of the above targets in order.
  1. View Results:

Once the tests have run, the results will be available in the results.csv file.

  1. Clean Up (Optional)

To clean up generated files and reset the environment, run:

make reset

This will remove generated matrices, vectors, results, and virtual environments.

curious-julia-numpy-matrix-solver's People

Contributors

ahmad-alkadri avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.