-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from bh107/create-quasicrystal-benchmark
Create quasicrystal benchmark
- Loading branch information
Showing
13 changed files
with
170 additions
and
19 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# -*- coding: utf-8 -*- | ||
from benchpress import util | ||
import numpy as np | ||
|
||
def main(): | ||
B = util.Benchmark() | ||
|
||
k = B.size[0] # number of plane waves | ||
stripes = B.size[1] # number of stripes per wave | ||
N = B.size[2] # image size in pixels | ||
ite = B.size[3] # iterations | ||
|
||
phases = np.arange(0, 2*np.pi, 2*np.pi/ite) | ||
image = np.empty((N, N), dtype=B.dtype) | ||
d = np.arange(-N/2, N/2, dtype=B.dtype) | ||
|
||
xv, yv = np.meshgrid(d, d) | ||
theta = np.arctan2(yv, xv) | ||
r = np.log(np.sqrt(xv*xv + yv*yv)) | ||
r[np.isinf(r) == True] = 0 | ||
|
||
tcos = theta * np.cos(np.arange(0, np.pi, np.pi/k))[:, np.newaxis, np.newaxis] | ||
rsin = r * np.sin(np.arange(0, np.pi, np.pi/k))[:, np.newaxis, np.newaxis] | ||
inner = (tcos - rsin) * stripes | ||
|
||
cinner = np.cos(inner) | ||
sinner = np.sin(inner) | ||
|
||
B.start() | ||
|
||
for phase in phases: | ||
image[:] = np.sum(cinner * np.cos(phase) - sinner * np.sin(phase), axis=0) + k | ||
util.Benchmark().flush() | ||
|
||
B.stop() | ||
B.pprint() | ||
|
||
if B.outputfn: | ||
B.tofile(B.outputfn, {'res': image}) | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Quasicrystal simulation | ||
|
||
Params example (k * stripes * image_size * iterations):: | ||
|
||
--size=5*37*4096*30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ Simon A. F. Lund | |
Mads R. B. Kristensen | ||
Troels Blum | ||
Kenneth Skovhede | ||
|
||
Mads Ohm Larsen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
|
||
.. _alain: | ||
|
||
Alain | ||
===== | ||
|
||
.. include:: ../../../benchmarks/alain/readme.rst | ||
|
||
|
||
.. _alain_python_numpy: | ||
|
||
Python Numpy | ||
------------ | ||
|
||
|
||
.. literalinclude:: ../../../benchmarks/alain/python_numpy/alain.py | ||
:language: python |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
|
||
.. _alain_counterexample: | ||
|
||
Alain Counterexample | ||
==================== | ||
|
||
.. include:: ../../../benchmarks/alain_counterexample/readme.rst | ||
|
||
|
||
.. _alain_counterexample_python_numpy: | ||
|
||
Python Numpy | ||
------------ | ||
|
||
|
||
.. literalinclude:: ../../../benchmarks/alain_counterexample/python_numpy/alain_counterexample.py | ||
:language: python |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
|
||
.. _idl_init_1loop: | ||
|
||
Idl Init 1Loop | ||
============== | ||
|
||
|
||
.. _idl_init_1loop_python_numpy: | ||
|
||
Python Numpy | ||
------------ | ||
|
||
|
||
.. literalinclude:: ../../../benchmarks/idl_init_1loop/python_numpy/idl_init_1loop.py | ||
:language: python |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
|
||
.. _idl_init_explode: | ||
|
||
Idl Init Explode | ||
================ | ||
|
||
|
||
.. _idl_init_explode_python_numpy: | ||
|
||
Python Numpy | ||
------------ | ||
|
||
|
||
.. literalinclude:: ../../../benchmarks/idl_init_explode/python_numpy/idl_init_explode.py | ||
:language: python |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
|
||
.. _quasicrystal: | ||
|
||
Quasicrystal | ||
============ | ||
|
||
.. include:: ../../../benchmarks/quasicrystal/readme.rst | ||
|
||
|
||
.. _quasicrystal_python_numpy: | ||
|
||
Python Numpy | ||
------------ | ||
|
||
|
||
.. literalinclude:: ../../../benchmarks/quasicrystal/python_numpy/quasicrystal.py | ||
:language: python |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters