Skip to content

scivision/python-performance

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
gfx
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Python Performance

Actions Status

All benchmarks are platform-independent (run on any computing device with appropriate hardware). CuPy tests require an NVIDIA GPU with CUDA toolkit installed.

Install

This command prepares Python prereqs:

pip install -r requirements.txt

Using the C and/or Fortran tests requires compilation using CMake.

cmake --workflow --preset default

Usage

Iterative benchmarks, here using the pisum algorithm:

python Pisum.py

Pi (Machin) benchmark Windows 10 Intel 19.1

Pi (Machin) benchmark Windows 10

Pi (Machin) benchmark


Matrix Multiplication benchmarks:

python Matmul.py

Hypotenuse

Observe that hypot() is faster from 1 to a few hundred elements, then sqrt(x^2+y^2) becomes slightly faster. However, hypot() does not overflow for arguments near REALMAX. For example, in Python:

from math import sqrt, hypot

a=1e154; hypot(a,a); sqrt(a**2+a**2);

1.414213562373095e+154
inf

Execute the Hypot speed test by:

python RunHypot.py

Python 3.6 hypot() vs rsq()

Python 2.7 hypot() vs rsq()

Python 3.5 hypot() vs rsq()

Notes

Julia

Julia binaries are often downloaded to a particular directory. Python doesn't pickup .bash_aliases, which is commonly used to point to Julia.

MKL selection

https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor

We give a hint to CMake where your MKL libraries on. For example:

MKLROOT=/opt/intel/mkl cmake ..

Of course this option can be combined with FC.

You can set this environment variable permanently for your convenience (normally you always want to use MKL) by adding to your ~/.bashrc the line:

export MKLROOT=/opt/intel/mkl

About

Performance benchmarks of Python, Numpy, etc. vs. other languages such as Matlab, Julia, Fortran.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published