Skip to content
Performance benchmarks of Python, Numpy, etc. vs. other languages such as Matlab, Julia, Fortran.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
NASA_JulesKouatchou
bin
cmake
iter
mandelbrot
matmul
pisum
pythonperformance
tests
.appveyor.yml
.gitattributes
.gitignore
.travis.yml
CMakeLists.txt
LICENSE
Matmul.py
NoneVsNan.py
NothingVsNan.jl
Pisum.py
README.md
RunHypot.py
WindowsStderr.py
carriage_return.py
checkversions.py
dis_blank.c
dis_div.c
dis_mult.c
h5py_write_speed.py
hypot.f90
isoctave.m
kind.f90
nans.py
netcdf_write_speed.py
no_traceback_error.py
perf.f90
setup.cfg
setup.py

README.md

image Coverage Status image

Python Performance

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

Continuous integration conducted on:

  • Ubuntu (Travis-CI)
  • MacOS (Travis-CI)
  • Windows (AppVeyor)

Tested on Python 3.5, 3.6 and PyPy3.

Install

This command compiles the Fortran code and prepares Python prereqs:

pip install -e .

Usage

Iterative benchmarks, here using the pisum algorithm:

./Pisum.py

Pi (Machin) benchmark

Matrix Multiplication benchmarks:

./Matmul.py

Fortran

"kind" demo:

./bin/kind

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:

./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.

Compiler selection

Intel Fortran:

FC=ifort cmake ..

GNU Fortran (gfortran ≥ 6 required):

FC=gfortran cmake ..

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
You can’t perform that action at this time.