ParRes / Kernels

This is a set of simple programs that can be used to explore the features of a parallel platform.
https://groups.google.com/forum/#!forum/parallel-research-kernels
Other
409 stars 107 forks source link

nstream-numba: get good performance by pulling 0th iteration call out of loop #539

Closed hattom closed 3 years ago

hattom commented 3 years ago

If this pull request is fixing a bug, please link the associated issue. The rest of this template does not apply.

If this pull request is providing a new implementation of the PRKs, please use the following template.

Note that checking all of the boxes is not required.

New PRK implementation checklist

Which kernels are implemented?

Documentation and build examples

If your implementation uses a new programming model that is not ubiquitious (i.e. included in the system compiler on most systems) then you need to provide a link to the appropriate documentation for a new user to install it, etc.

We strongly recommend that you add the appropriate features to make.defs.${toolchain} if appropriate.

Do you certify that your contribution is made in good faith and does not attempt to introduce any negative behavior into this project?

Before:

python PYTHON/nstream-numba.py 100 100000
Python version =  3.7
Numpy version  =  1.16.4
Parallel Research Kernels version 
Python Numpy STREAM triad: A = B + scalar * C
Number of iterations =  100
Vector length        =  100000
Solution validates
Rate (MB/s):  1787.9912007142032  Avg time (s):  0.0017897179800000008

After:

python PYTHON/nstream-numba.py 100 100000
Python version =  3.7
Numpy version  =  1.16.4
Parallel Research Kernels version 
Python Numpy STREAM triad: A = B + scalar * C
Number of iterations =  100
Vector length        =  100000
Solution validates
Rate (MB/s):  35320.83292264001  Avg time (s):  9.059808999999142e-05
hattom commented 3 years ago

Now that I'm looking at it, I think the same would have been achieved by changing if k<0: t0 = timer() to if k==1: t0 = timer(). I was thinking something weirder was going on.

jeffhammond commented 3 years ago

LGTM

haven't verified because i am still trying to install Numba on my new laptop but that isn't critical