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

Insert SortTrackAction when sorting by particle type #1059

Merged
merged 7 commits into from
Dec 13, 2023

Conversation

esseivaju
Copy link
Contributor

@esseivaju esseivaju commented Dec 10, 2023

I didn't update the switch statement which is inserting the SortTracksAction in #1044.

Also refactoring CoreState to only have the necessary thread_offsets_ collection, moving all the template code to the internal state struct CoreStateThreadOffsets.

@esseivaju esseivaju added bug Something isn't working performance Changes for performance optimization labels Dec 10, 2023
@esseivaju esseivaju requested a review from sethrj December 10, 2023 22:49
@sethrj
Copy link
Member

sethrj commented Dec 11, 2023

Changing the "default" to spelling out the remaining options would be safer since clang will catch the omission.

@esseivaju
Copy link
Contributor Author

yes, I was considering doing that (or using pragma diagnostic switch-enum?) but given that we do a switch on that enum in many places and it's not likely to get updated often, I ended up leaving the default. Maybe just doing it in accel is fine since it's not closely related to SortTracksAction you're more likely to forget it here.

@sethrj
Copy link
Member

sethrj commented Dec 11, 2023

For some reason github isn't letting me code review. Two comments:

  1. Can you add a super small test to TrackSort.test.cc that fails before the fix and passes after? (maybe we need something more "manual" than running a whole tracking loop? i.e. something to fill up some bogus states and just launch the action)
  2. Does is_sort_by_action in SortTracksAction.cc also need to be updated? If so maybe it needs to be rephrased by negating the enums that don't need sorting.

@esseivaju
Copy link
Contributor Author

esseivaju commented Dec 11, 2023

  1. Can you add a super small test to TrackSort.test.cc that fails before the fix and passes after? (maybe we need something more "manual" than running a whole tracking loop? i.e. something to fill up some bogus states and just launch the action)

Mmh, how would you test that? You have to instantiate CoreParams and check that it is in the expected state given its input. Wouldn't that fit better in a dedicated CoreParams unit test?

  1. Does is_sort_by_action in SortTracksAction.cc also need to be updated? If so maybe it needs to be rephrased by negating the enums that don't need sorting.

This doesn't need to be updated. This is used when sorting on a key that would allow to launch a kernel with a reduced grid size. This is not the case for particle_type.

@sethrj
Copy link
Member

sethrj commented Dec 12, 2023

TrackSort.test.cc already does create core instances. You could manually call the initialize track action to set a bunch of primaries, then just manually call the sort action, then check that the order is correct?

@esseivaju esseivaju force-pushed the bugfix-insert-sortaction branch from 864bd4a to faa8f0b Compare December 13, 2023 02:33
Copy link
Member

@sethrj sethrj left a comment

Choose a reason for hiding this comment

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

Nice improvement. Thanks for figuring out a way to add the tests!

@sethrj sethrj enabled auto-merge (squash) December 13, 2023 06:09
@sethrj sethrj merged commit 7b7bfb2 into celeritas-project:develop Dec 13, 2023
19 of 20 checks passed
@esseivaju esseivaju deleted the bugfix-insert-sortaction branch May 29, 2024 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working performance Changes for performance optimization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants