Skip to content
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

[BUGFIX] Fix particle selection for corner cases of morton index values #2575

Merged
merged 47 commits into from Jun 5, 2020

Conversation

matthewturk
Copy link
Member

Thanks to @langmm for debugging this with me and for identifying the precise problem. We discovered there was a corner case for filling subregions of mi1 and mi2, which showed up in #2574. This corrects that by choosing the region correctly.

This is a bug identified by some work I'm doing that will add comprehensive testing to particle
selection.

This fixes #2574.

Thanks to Meagan Lang for debugging this with me.  We discovered there
was a corner case for filling subregions of mi1 and mi2, which showed up
in yt-project#2574.  This corrects that by choosing the region correctly.
@matthewturk matthewturk added bug demeshening Removing the global mesh for particles index: particle labels May 4, 2020
@matthewturk matthewturk added this to the 4.0 milestone May 4, 2020
@matthewturk matthewturk added this to In progress in yt-4.0 release via automation May 4, 2020
@matthewturk
Copy link
Member Author

I would like to get reviews on this (the tests should pass as I had originally pushed backwards logic for is_refined) and hld off on merging until I demonstrate that it fixes functionality; I have a PR incoming on that. Then once that is shown via failing (new) tests, we had hit the button on this, then hit the button on the other one.

Copy link
Contributor

@langmm langmm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few minor issues (unused variable needs removed and upper range for the method filling coarse cells would need increased), but I also added a few suggestions which might improve performance.

yt/geometry/particle_oct_container.pyx Show resolved Hide resolved
yt/geometry/particle_oct_container.pyx Outdated Show resolved Hide resolved
yt/geometry/particle_oct_container.pyx Outdated Show resolved Hide resolved
yt/geometry/particle_oct_container.pyx Outdated Show resolved Hide resolved
matthewturk and others added 4 commits May 5, 2020 12:24
Co-authored-by: Meagan Lang <cfh5058@gmail.com>
Co-authored-by: Meagan Lang <cfh5058@gmail.com>
Co-authored-by: Meagan Lang <cfh5058@gmail.com>
@Xarthisius
Copy link
Member

After merging this to 2577 tests still fail for me:

======================================================================
FAIL: This checks that we correctly subselect from a dataset, first by making
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/xarth/.local/lib/python3.6/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/home/xarth/codes/yt-project/yt/yt/frontends/gadget/tests/test_outputs.py", line 129, in test_particle_subselection
    assert_equal(psc.compare_dobj_selection(sp3) , True)
  File "/home/xarth/.local/lib/python3.6/site-packages/numpy/testing/_private/utils.py", line 428, in assert_equal
    raise AssertionError(msg)
AssertionError: 
Items are not equal:
 ACTUAL: False
 DESIRED: True

@matthewturk
Copy link
Member Author

The failing test is sp3 which wraps around the domain along all three axes. I'm adding some more test cases to narrow this down. It does not seem to be related to the smoothing length.

@matthewturk
Copy link
Member Author

OK, I've changed my mind, it is related to smoothing length, indirectly. Overriding the smoothing length in the io-handler causes this to work.

I believe what is happening is that the periodic smoothing lengths are not being selected inside identify_file_masks, which is what chooses which files are read. I'm looking into that now, as I need to determine if it's not choosing an unrefined cell or a refined cell.

(This is precisely the kind of bug this test was supposed to ferret out, too!)

@matthewturk
Copy link
Member Author

The current commit reworks the smoothing length bitmap indexing at the coarse level for periodic boundary conditions. It will not be ready to go in until I've both addressed this in the refined level and tested this.

At present for my test case, this fixes the problem, but it also throws errors for computing the bitmap indices, as it is now setting a few refined cells that are not on the coarse level. Until at a bare minimum that is addressed this cannot go in.

@matthewturk
Copy link
Member Author

OK, now that I've explicitly cast to uword in the vendored ewah code, I am out of ideas for why it's failing to compile on appveyor. 😡

@matthewturk
Copy link
Member Author

One thing I would note is that I've snuck in an update to using bionic, as per @Xarthisius 's suggestion, on Travis.

@matthewturk
Copy link
Member Author

The travis answer test failure is itty bitty, and likely a result of a minor compiler change. I'd like to propose that review commence, and then I update the answer tests.

@matthewturk
Copy link
Member Author

PR for answers is here: yt-project/answer-store#4

Copy link
Member

@munkm munkm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of questions and one super minor nit. LGTM!

reg._set_refined_index_data_file(
sub_mi1, sub_mi2, i, nsub_mi)
nsub_mi, coll = reg._refined_index_data_file(
coll, pos, hsml, mask, sub_mi1, sub_mi2, i,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use None on l182 here like you did at 218? Or am I missing something subtle that coll needs to be defined here on l179 but not there?

@@ -1,5 +1,5 @@
language: python
dist: xenial
dist: bionic
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I must have missed the reason for switching dists in travis. What was that for?

Copy link
Contributor

@ax3l ax3l Oct 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ups, this slipped through and caused a regression: older GCC (<6) need explicit C++11 flags in the build system, otherwise they will fail to build: #2892
It's not clear to me why this is not set though, because setup.py sets extra_compile_args=["-std=c++11"])... 🤔 Does it need to be added to further Extensions that include the same header?

@@ -3,6 +3,6 @@ available at:

https://github.com/lemire/EWAHBoolArray

Currently this is at revision 80881379f8a582f45dda1be9edfc84d244846427.
Currently this is at revision 88b25a3345b82353ccd97a7de6064e6c179a7cc2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh I see this got updated

@munkm munkm merged commit ad8fc19 into yt-project:yt-4.0 Jun 5, 2020
yt-4.0 release automation moved this from In progress to Done Jun 5, 2020
matthewturk added a commit to matthewturk/yt that referenced this pull request Jun 8, 2020
munkm added a commit that referenced this pull request Jun 8, 2020
Xarthisius added a commit to yt-project/answer-store that referenced this pull request Jul 19, 2020
More details about the test failure can be found at the URL: http://use.yt/upload/84bbfca3
answer(s) for failed test at URL: http://use.yt/upload/bc305b8c
This was referenced Oct 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker Highest priority level bug demeshening Removing the global mesh for particles index: particle
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

6 participants