Skip to content

Particle Ids: Add int Constants#3338

Merged
WeiqunZhang merged 1 commit intoAMReX-Codes:developmentfrom
ax3l:topic-int-max-ids
Jun 6, 2023
Merged

Particle Ids: Add int Constants#3338
WeiqunZhang merged 1 commit intoAMReX-Codes:developmentfrom
ax3l:topic-int-max-ids

Conversation

@ax3l
Copy link
Copy Markdown
Member

@ax3l ax3l commented Jun 1, 2023

Summary

Ideally we do not need them, because 2B particles
generated per GPU is very low, but we do need this temporarily until we find a way to generalize large id values again for pure SoA particle layouts.

cc @AlexanderSinn

Additional background

Follow-up to #2878.

Checklist

The proposed changes:

  • fix a bug or incorrect behavior in AMReX
  • add new capabilities to AMReX
  • changes answers in the test suite to more than roundoff level
  • are likely to significantly affect the results of downstream AMReX users
  • include documentation in the code and/or rst files, if appropriate

Ideally we do not need them, because 2B particles
generated per GPU is very low, but we do need this temporarily
until we find a way to generalize large id values again for
pure SoA particle layouts.
@ax3l ax3l requested a review from atmyers June 1, 2023 04:36
next = the_next_id++;

if (next > LastParticleID)
if (next > IntParticleIds::LastParticleID)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If the user adds particles in large batches, then this check could miss an overflow after which next would be negative.

Copy link
Copy Markdown
Member Author

@ax3l ax3l Jun 1, 2023

Choose a reason for hiding this comment

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

Yes, fully agree. I am doubtful about a lot of these checks here.
The same problem is present for the (signed) Long ids.

I guess the idea about those is that one catches at least some problem if assigning ids contiguously. One could improve the checks here (and for the Longs) slightly by checking hat a next id is also not negative. But probably a separate PR.

@ax3l
Copy link
Copy Markdown
Member Author

ax3l commented Jun 6, 2023

ping @atmyers @AlexanderSinn ready to merge? :)

@WeiqunZhang WeiqunZhang merged commit d9bae8c into AMReX-Codes:development Jun 6, 2023
@ax3l ax3l deleted the topic-int-max-ids branch June 6, 2023 01:35
WeiqunZhang added a commit to WeiqunZhang/amrex that referenced this pull request Jun 6, 2023
Explicitly convert amrex::Long to int.
ax3l pushed a commit that referenced this pull request Jun 6, 2023
Explicitly convert amrex::Long to int.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants