-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
initial stab at the numba.typed.List benchmarks #10
base: master
Are you sure you want to change the base?
Conversation
This is an intial stab at the ASV tests for the `numba.typed.List`. Things that still need to be decided on: * Do we want to measure compile time too? If so, how? * Is compile time included in these benchmarks or not? Lastly, here is a snapshot of what it looks like when run on my laptop: ``` 💣 zsh» asv run --show-stderr -b 'bench_typed_list*' · Fetching recent changes. · Creating environments · Discovering benchmarks · Running 4 total benchmarks (1 commits * 1 environments * 4 benchmarks) [ 0.00%] · For numba commit 1949c62e <master>: [ 0.00%] ·· Benchmarking conda-py3.6-cudatoolkit-llvmlite-numpy [ 12.50%] ··· Running (bench_typed_list.ConstructionSuite.time_construct_from_python_list--).... [ 62.50%] ··· bench_typed_list.ConstructionSuite.time_construct_from_python_list 97.8±1ms [ 75.00%] ··· bench_typed_list.ConstructionSuite.time_construct_in_njit_function 2.61±0.1ms [ 87.50%] ··· bench_typed_list.ReductionSuite.time_reduction_sum 203±9μs [100.00%] ··· bench_typed_list.SortSuite.time_sort 117±4ms asv run --show-stderr -b 'bench_typed_list*' 23.89s user 1.37s system 85% cpu 29.624 total ```
class ConstructionSuite: | ||
|
||
def setup(self): | ||
self.pl = make_random_python_list(SIZE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should seed the the rng
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
benchmarks/bench_typed_list.py
Outdated
class ReductionSuite: | ||
|
||
def setup(self): | ||
self.tl = make_random_typed_list(SIZE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs to seed rng
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done too.
We do want compile time. It can make a fresh dispatcher and run the |
benchmarks/bench_typed_list.py
Outdated
agg += i | ||
return agg | ||
|
||
self.reduction_sum = njit(reduction_sum) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without fastmath
this won't vectorize (should probably test both with and without). I also wonder if the iterator will vectorize vs an explicit induced loop, something to look at. The iterator loop will likely be full of refops.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am testing both now, they seem to have very similar run-time characteristics, will need to look at vectorization. But testing both is worthwhile in it's own right. Testing compilation time too now.
To ensure the reproducibility of the results, we seed the (pseudo-) random number generator.
Since we want to catch compile time regressions too, we benchmark the compile-time.
Implement the steps in `dispatcher.compile` to clear out the cache etc.. to ensure we really do get a fresh compile during every benchmark.
This makes the function reusable.
I have update the tests to seed the RNG and to time compilation. Here is snapshot of a run on my machine:
|
Distinguish between for-loop based and iterator based iteration and between integers and floats.
With recent updates, these are the current benchmarks for the changes introduced by: numba/numba#6278
|
README.md
Outdated
Run `asv` on the first commit: | ||
|
||
```bash | ||
asv run "-1 abcdefg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
asv run "-1 abcdefg | |
asv run "-1 abcdefg" |
also, that's hexadecimal? Why's there a g
in it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessarily, it can be any commit-ish - which includes tags and branches. Though I understand that this is misleading because it looks like hex.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 5c870d3
README.md
Outdated
Run `asv` on the second commit: | ||
|
||
```bash | ||
asv run "-1 1235567 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
asv run "-1 1235567 | |
asv run "-1 1235567" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in 5c870d3
README.md
Outdated
```bash | ||
asv run --verbose --show-stderr -b 'bench_typed_list' "-1 abcdefg" | ||
``` | ||
|
||
```bash | ||
asv compare --machine machine.local "abcdefg" "1234567" | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add 1 line to say what they do/why they are useful?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 5c870d3
Fixed some syntax issues, made the metsyntactic placeholders for commit-ish's less ambiguous and expanded the descriptions.
This is an intial stab at the ASV tests for the
numba.typed.List
.Things that still need to be decided on:
Lastly, here is a snapshot of what it looks like when run on my laptop: