-
Notifications
You must be signed in to change notification settings - Fork 271
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
Move interpolation routines to pxd #2849
base: main
Are you sure you want to change the base?
Conversation
What's the reason for the line count diff ? |
I deleted the old Will have to figure out what's up with the grid traversal build failure on fido. |
We need to have this be inside, and use pointers, so that we aren't implicitly *executing* code or using *python* code in the pxd file.
Real errors! Probably a mistake I made in my code, which I will address. |
There doesn't seem to be significant performance implication, at least regarding isocontours extraction (we should double check the cost for volume rendering as well). With this PR:
With master:
|
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.
Assuming we check that the perf were not degraded, I'm all in!
@cphyc thanks for the fix! I'm game for this going in; the perf does not seem to be a big deal, and is likely swallowed up by perf implications of other things that could be improved. |
Have you tried volume rendering? |
Yes, but I did not write down the numbers. Will attempt to do some perf comparisons asap. |
yt.visualization.volume_rendering.tests.test_mesh_render.test_surface_mesh_render goes from 3.8746s to 7.9495s with this PR! |
oof, ok.
…On Wed, Sep 2, 2020 at 3:09 PM Corentin Cadiou ***@***.***> wrote:
Yes, but I did not write down the numbers. Will attempt to do some perf
comparisons asap.
yt.visualization.volume_rendering.tests.test_mesh_render.test_surface_mesh_render
goes from 3.8746s to 7.9495s with this PR!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#2849 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAVXO7ZYETNSTP7W6BOQUTSD2Q7ZANCNFSM4P5JBJCQ>
.
|
Ignore this comment, I just reran it with completely different results. |
So maybe it's OK to go? |
I'm ok in principle, but I would like to have some robust performance test (esp. for volume rendering) before merging. |
@cphyc fair! OK I'll work on that. |
@cphyc I'm looking at this again and I'm not 100% convinced I still want it with the changes you made, but I'm going to add the perf anyway. |
@yt-fido test this please |
I had to commit this before I completed it; I'm also finding some strange memory things that I need to convince myself are not real before I proceed. |
for i in range(3): | ||
random_index[:, i] = np.random.randint(0, shape[i], size=M, dtype="u8") |
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.
for i in range(3): | |
random_index[:, i] = np.random.randint(0, shape[i], size=M, dtype="u8") | |
for i, s in enumerate(shape): | |
random_index[:, i] = np.random.randint(0, s, size=M, dtype="u8") |
random_index = np.random.randint((0, 0, 0), shape, size=(M, 3), dtype="u8") | ||
random_index = np.empty((M, 3), dtype="u8") | ||
for i in range(3): | ||
random_index[:, i] = np.random.randint(0, shape[i], size=M, dtype="u8") | ||
random_offset = np.random.random((M, 3)) | ||
# import time |
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.
@matthewturk could we clean up the commented code here while we're at it ?
Well, I intentionally left it in so that we could compare these when I
stuck it into master. So I will, but later.
…On Fri, Sep 25, 2020 at 10:56 AM Clément Robert ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In yt/utilities/lib/tests/test_interpolation_routines.py
<#2849 (comment)>:
> + for i in range(3):
+ random_index[:, i] = np.random.randint(0, shape[i], size=M, dtype="u8")
⬇️ Suggested change
- for i in range(3):
- random_index[:, i] = np.random.randint(0, shape[i], size=M, dtype="u8")
+ for i, s in enumerate(shape):
+ random_index[:, i] = np.random.randint(0, s, size=M, dtype="u8")
------------------------------
In yt/utilities/lib/tests/test_interpolation_routines.py
<#2849 (comment)>:
> @@ -9,7 +9,9 @@ def test_fast_interpolate():
N = 10000
M = 1000
random_values = np.random.random(shape)
- random_index = np.random.randint((0, 0, 0), shape, size=(M, 3), dtype="u8")
+ random_index = np.empty((M, 3), dtype="u8")
+ for i in range(3):
+ random_index[:, i] = np.random.randint(0, shape[i], size=M, dtype="u8")
random_offset = np.random.random((M, 3))
# import time
@matthewturk <https://github.com/matthewturk> could we clean up the
commented code here while we're at it ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2849 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAVXO27WL5PJUWVI2BCWVDSHS4SFANCNFSM4P5JBJCQ>
.
|
@matthewturk I'm waiting for your answer but I'm ready to approve+merge this ! |
I actually spent some trying to compare, and then I forget what happened. I will attempt again. |
This is starting to drift into the conflict realm. |
Yes, it is, but I'm still struggling to get the micro-benchmarks. Won't be too hard to harmonize... |
I'm converting this to draft until after 4.0 goes out so that it won't show up in my filters. The performance tests are harder than I expected. |
@matthewturk do you want to pick this up again for the 4.1 release or should we take it out of the milestone ? |
Let's take it out. |
PR Summary
This moves some functions that are in C into a
pxd
file, and marks them as inline.Why do this, you might ask? Good question! It turns out that on some compiler combinations, we got into a situation where marking the
grid_traversal.pyx
file as c++ resulted in a propagation of C++ that ended up with cross-C/C++ calls that were disallowed. Anyway, this fixes it!What we should definitely keep an eye on is performance regressions.
PR Checklist
black --check yt/
isort . --check --diff
flake8 yt/