Skip to content

Commit

Permalink
Went through all NumPy benchmarks got them running and documented them.
Browse files Browse the repository at this point in the history
Of the 36 benchmarks 14 has implementation issues which includes segfaulting, cannot run with Bohrium due to lack of Bohrium features and other things.

blacks_scholes-python_numpy: Supports dogma "High-Performance NumPy without changing a single line of code.".

convolve-python_numpy: Dogmatized and documented Bohrium related issues.

convolve_2d-python_numpy: Dogmatized and documented Bohrium related issues.

convolve_3d-python_numpy: Dogmatized and documented Bohrium related issues.

convolve_separate-python_numpy: Dogmatized and documented Bohrium related issues.

gameoflife-python_numpy: Dogmatized.

gauss-python_numpy: Dogmatized.

Forgot this...

heat_equation-python_numpy: Dogmatized.

idl_init_bh-python-numpy: Fixed encoding error and noted issues.

idl_init_fast-python-numpy: Documented issues.

idl_init_orig-python-numpy: Documented issues.

jacobi: Added a brief description and dogmatized NumPy version.

jacobi-fixed: Added a brief description, dogmatized NumPy version and documented use of Bohrium features.

jacobi_solve: Added a brief description and dogmatized NumPy version.

k_nearest_neighbor: Documented issues.

knn_naive: Added description and dogmatized Numpy implementation.

knn_naive1: Added description and dogmatized Numpy implementation.

knn_naive: Removed since it is a duplicate of knn_naive1.

Leave knn_naive1 since it has history, knn_naive does not.

lattice_boltzmann_D2Q9: Documented issues and use.

lbm_3d: Documented use and dogmatized NumPy implementation.

LMM_swaption_vec: Documented use and issues.

lu: Brief docs and dogmatization.

Moved the LMM swaption benchmark.

benchmark-autodoc: Added display of issues and bohrium info.

Added notes in benchmarks matrix about issues and bohrium specifics.

jacobi_stencil: Same story...

mc: Same story...

mxmul: Same story.

nbody: Same story.

nbody: Same story.

same story

nbody_nice: Same story.

ndstencil: Same story.

point27: Same story.

ndstencil: Added dogma.

autodoc-benchmarks: Added the dogma-note to benchmark-matrix.

Pricing and Shallow water.

snakes_and_ladders...

...

sor ...

more...

Went through all NumPy benchmarks got them running and documented them.

Of the 36 benchmarks 14 has implementation issues which includes segfaulting, cannot run with Bohrium due to lack of Bohrium features and other things.
  • Loading branch information
safl committed Apr 1, 2015
1 parent b2c712f commit 0139f8e
Show file tree
Hide file tree
Showing 154 changed files with 667 additions and 418 deletions.
15 changes: 6 additions & 9 deletions benchmarks/black_scholes/python_numpy/black_scholes.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
from __future__ import print_function
import util
if util.Benchmark().bohrium:
import bohrium as np
else:
import numpy as np
from benchpress import util
import numpy as np

def model(N, B):
"""Construct pseudo-data representing price samples?"""
Expand Down Expand Up @@ -62,17 +59,17 @@ def main():
if B.inputfn:
S = B.load_array()
else:
S = model(N, B) # Construct pseudo-data
S = model(N, B) # Construct pseudo-data

if B.dumpinput:
B.dump_arrays("black_scholes", {'input': S})

B.start()
R = price(S, I, visualize=B.visualize) # Run the model
R = price(S, I, visualize=B.visualize) # Run the model
B.stop()
B.pprint()
# Convert to one array
for i in range(len(R)):

for i in range(len(R)): # Convert to one array
if hasattr(R[i], "copy2numpy"):
R[i] = R[i].copy2numpy()[()]
if B.outputfn:
Expand Down
4 changes: 4 additions & 0 deletions benchmarks/black_scholes/readme.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
A finance thing::

--size=1000000*10

3 changes: 3 additions & 0 deletions benchmarks/convolve/python_numpy/bohrium.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The view generator ``bohrium.stdviews`` module is used.

Specifically the ``cartesian`` generator.
7 changes: 2 additions & 5 deletions benchmarks/convolve/python_numpy/convolve.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
from __future__ import print_function
from PIL import Image
import util
if util.Benchmark().bohrium:
import bohrium as np
else:
import numpy as np
from benchpress import util
import numpy as np
from bohrium.stdviews import cartesian

def apply_filter(size, weight):
Expand Down
File renamed without changes.
9 changes: 9 additions & 0 deletions benchmarks/convolve/python_numpy/issues.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Fails when running with Bohrium::

python -m bohrium convolve.py --size=25 --bohrium=True

Produces the following error::

~/.local/lib/python2.7/site-packages/bohrium/__main__.py:20: RuntimeWarning: Encounter ing an operation not supported by Bohrium. It will be handled by the original NumPy. execfile(sys.argv[0])
Segmentation fault (core dumped)

3 changes: 3 additions & 0 deletions benchmarks/convolve_2d/python_numpy/bohrium.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The view generator ``bohrium.stdviews`` module is used.

Specifically the ``cartesian`` generator.
7 changes: 2 additions & 5 deletions benchmarks/convolve_2d/python_numpy/convolve_2d.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
from __future__ import print_function
from PIL import Image
import util
if util.Benchmark().bohrium:
import bohrium as np
else:
import numpy as np
from benchpress import util
import numpy as np
from bohrium.stdviews import cartesian

def gen_2d_filter(size, weight, datatype=np.float32):
Expand Down
9 changes: 9 additions & 0 deletions benchmarks/convolve_2d/python_numpy/issues.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Fails when running with Bohrium::

python -m bohrium convolve_2d.py --size=25 --bohrium=True

Produces the following error::

~/.local/lib/python2.7/site-packages/bohrium/__main__.py:20: RuntimeWarning: Encounter ing an operation not supported by Bohrium. It will be handled by the original NumPy. execfile(sys.argv[0])
Segmentation fault (core dumped)

3 changes: 3 additions & 0 deletions benchmarks/convolve_3d/python_numpy/bohrium.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The view generator ``bohrium.stdviews`` module is used.

Specifically the ``cartesian`` generator.
7 changes: 2 additions & 5 deletions benchmarks/convolve_3d/python_numpy/convolve_3d.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
from __future__ import print_function
from PIL import Image
import util
if util.Benchmark().bohrium:
import bohrium as np
else:
import numpy as np
from benchpress import util
import numpy as np
from bohrium.stdviews import cartesian

def gen_3d_filter(size, weight, datatype=np.float32):
Expand Down
10 changes: 10 additions & 0 deletions benchmarks/convolve_3d/python_numpy/issues.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Fails when running with Bohrium::

python -m bohrium convolve_3d.py --size=25 --bohrium=True

Produces the following error::

.local/lib/python2.7/site-packages/bohrium/__main__.py:21: RuntimeWarning: Encountering an operation not supported by Bohrium. It will be handled by the original NumPy.
else:
Segmentation fault (core dumped)

Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
from __future__ import print_function
import sys
from numpy.linalg import svd
import util

if util.Benchmark().bohrium:
import bohrium as np
else:
import numpy as np
from benchpress import util
import numpy as np

def generate_gauss_matrix(filter_shape, sigma, data_type=np.float32):
"""
Expand Down
8 changes: 8 additions & 0 deletions benchmarks/convolve_separate_std/python_numpy/issues.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Running::

python -m bohrium convolve_separate_std.py --size=500*15 --bohrium=True

Produces the error::

Segmentation fault (core dumped)
7 changes: 2 additions & 5 deletions benchmarks/gameoflife/python_numpy/gameoflife.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
So what does this code example illustrate?
"""
import util
if util.Benchmark().bohrium:
import bohrium as np
else:
import numpy as np
from benchpress import util
import numpy as np

SURVIVE_LOW = 2
SURVIVE_HIGH = 3
Expand Down
File renamed without changes.
8 changes: 3 additions & 5 deletions benchmarks/gauss/python_numpy/gauss.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from __future__ import print_function
import util
if util.Benchmark().bohrium:
import bohrium as np
else:
import numpy as np
from benchpress import util
import numpy as np

import bohrium.linalg as la

def main():
Expand Down
File renamed without changes.
7 changes: 2 additions & 5 deletions benchmarks/heat_equation/python_numpy/heat_equation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
So what does this code example illustrate?
"""
import util
if util.Benchmark().bohrium:
import bohrium as np
else:
import numpy as np
from benchpress import util
import numpy as np

def freezetrap(height, width, dtype=np.float32):
"""Construct the grid."""
Expand Down
1 change: 1 addition & 0 deletions benchmarks/idl_init_bh/python_numpy/idl_init_bh.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# This Python file uses the following encoding: utf-8
from __future__ import print_function
from time import time
from sys import argv
Expand Down
2 changes: 2 additions & 0 deletions benchmarks/idl_init_bh/python_numpy/issues.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Several issues with this Benchmark, it might have worked a year ago, but it currently relies on Bohrium features that no longer exists and other problems.

1 change: 1 addition & 0 deletions benchmarks/idl_init_fast/python_numpy/idl_init_fast.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# This Python file uses the following encoding: utf-8
from __future__ import print_function
from time import time
import numpy as np
Expand Down
7 changes: 7 additions & 0 deletions benchmarks/idl_init_fast/python_numpy/issues.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Several issues, among them:

* Does not use the benchpress util
* Fails horribly when executed with Bohrium
* ...

Needs a lot of love.
7 changes: 7 additions & 0 deletions benchmarks/idl_init_orig/python_numpy/issues.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Several issues, among them:

* Does not use the benchpress util
* Fails horribly when executed with Bohrium
* ...

Needs a lot of love.
1 change: 1 addition & 0 deletions benchmarks/jacobi/python_numpy/bohrium.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Uses Bohrium features from ``bohrium.stdviews`` specifically ``no_border``, ``grid``, and ``diagonals``.
File renamed without changes.
7 changes: 2 additions & 5 deletions benchmarks/jacobi/python_numpy/jacobi.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
from __future__ import print_function
import util
if util.Benchmark().bohrium:
import bohrium as np
else:
import numpy as np
from benchpress import util
import numpy as np
from bohrium.stdviews import no_border, grid, diagonals

def jacobi_init(size):
Expand Down
3 changes: 3 additions & 0 deletions benchmarks/jacobi/readme.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This implementation runs jacobi on a quadratic grid until it converges.

Example params: --size=1000
1 change: 1 addition & 0 deletions benchmarks/jacobi_fixed/python_numpy/bohrium.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Uses Bohrium features from ``bohrium.stdviews`` specifically ``no_border``, ``grid``, and ``diagonals``.
7 changes: 2 additions & 5 deletions benchmarks/jacobi_fixed/python_numpy/jacobi_fixed.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
from __future__ import print_function
import util
if util.Benchmark().bohrium:
import bohrium as np
else:
import numpy as np
from benchpress import util
import numpy as np
from bohrium.stdviews import no_border, grid, diagonals

def jacobi_fixed_init(size):
Expand Down
4 changes: 4 additions & 0 deletions benchmarks/jacobi_fixed/readme.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Run jacobi for a fixed number of iterations on a quadratic grid::

python jacobi_fixed.py --size=5000*10

7 changes: 2 additions & 5 deletions benchmarks/jacobi_solve/python_numpy/jacobi_solve.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
from __future__ import print_function
import util
if util.Benchmark().bohrium:
import bohrium as np
else:
import numpy as np
from benchpress import util
import numpy as np

def freezetrap(height, width, dtype=np.float32):
grid = np.zeros((height+2,width+2), dtype=dtype)
Expand Down
4 changes: 4 additions & 0 deletions benchmarks/jacobi_solve/readme.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Runs Jacobi on a rectangular grid for until it converges or until max iterations is reached::

--size=1000*1000*100

7 changes: 2 additions & 5 deletions benchmarks/jacobi_stencil/python_numpy/jacobi_stencil.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
from __future__ import print_function
import util
if util.Benchmark().bohrium:
import bohrium as np
else:
import numpy as np
from benchpress import util
import numpy as np

def freezetrap(height, width, dtype=np.float32):
grid = np.zeros((height+2,width+2), dtype=dtype)
Expand Down
4 changes: 4 additions & 0 deletions benchmarks/jacobi_stencil/readme.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Runs jacobi on a rectangular grid without convergence for the given amount of iterations::

--size=5000*5000*10

1 change: 1 addition & 0 deletions benchmarks/k_nearest_neighbor/python_numpy/issues.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Does not actually call the implementation.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
So what does this code example illustrate?
"""
import util
if util.Benchmark().bohrium:
import bohrium as np
else:
import numpy as np
from benchpress import util
import numpy as np

def classify(sample, training, group=None, k=1):
assert sample.ndim == 2
Expand Down
1 change: 1 addition & 0 deletions benchmarks/k_nearest_neighbor/readme.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A think this was an attempt at writing a better KNN implementation.
72 changes: 0 additions & 72 deletions benchmarks/knn_naive/python_numpy/knn_naive.py

This file was deleted.

7 changes: 2 additions & 5 deletions benchmarks/knn_naive1/python_numpy/knn_naive1.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
from __future__ import print_function
import util
if util.Benchmark().bohrium:
import bohrium as np
else:
import numpy as np
from benchpress import util
import numpy as np

def data_range(B, N, F):
"""Pseudo-data setup using Python-range."""
Expand Down
4 changes: 4 additions & 0 deletions benchmarks/knn_naive1/readme.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Naive implementation of KNN --size=N*Features*Neighbors::

--size=20000000*10*4

4 changes: 4 additions & 0 deletions benchmarks/lattice_boltzmann_D2Q9/python_numpy/issues.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Copies data back and forth between NumPy and Bohrium::

.local/lib/python2.7/site-packages/bohrium/__main__.py:55: RuntimeWarning: Encountering an operation not supported by Bohrium. It will be handled by the original NumPy.

0 comments on commit 0139f8e

Please sign in to comment.