-
Notifications
You must be signed in to change notification settings - Fork 201
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
Fix out of bounds access to distance_to_eb
#4831
Merged
RemiLehe
merged 7 commits into
ECP-WarpX:development
from
roelof-groenewald:fix_AddNParticles
Apr 10, 2024
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a4956b4
Fix out of bounds access to `distance_to_eb`
roelof-groenewald c39bd46
Fix clang-tidy error
roelof-groenewald 235e90d
specify level for redistribute and set `nGrow=1`
roelof-groenewald 4378298
Set `local=0` in order to avoid unnecessary communication in the seco…
roelof-groenewald aee6b34
Switch `local` back to `1`.
roelof-groenewald 5318512
move second redistribute inside EB-only block
roelof-groenewald 68fa761
do not use `lev` since particles are anyway deposited on level 0
roelof-groenewald File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
specify level for redistribute and set
nGrow=1
- Loading branch information
commit 235e90db952959545b1d4b8d957998f8b9249029
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 still think that the
local
argument should be 1, since it is expecting anint
. The description for local says "If > 0, this is the maximum number of cells a particle can have moved since the last Redistribute() call." It is not a flag.I was thinking that if nGrow=1 and local=1, the routine might be smart enough to know that no communication is needed. No communication is needed since it is only removing invalid particles. Is there maybe a separate routine that does just that? This would need a comment from @WeiqunZhang
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.
Oh, I see. I definitely interpreted
local
incorrectly. I guess it should actually belocal=0
then, since the particles will have moved at all since the previous timeRedistribute()
was called.Looking at the code in
AMReX_ParticleContainerI.H
,nGrow
is used in thelocateParticle()
function (here) only after the particle could not be located within theParticleLocData
withnGrow=0
- basically it expands the search area withnGrow
. Therefore, seeing as the firstRedistribute
call happens withnGrow=0
, it shouldn't make any difference to have the second one usenGrow=1
.There was some mention recently of creating a function that will only remove invalid particles, but as far as I know that has not been done yet.
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.
This confuses me though since the default value for
local
is0
, meaning usually when we callRedistribute
it is as if we specify that the particles have not moved.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.
Local=0 means a global communication will be done as if particles may have moved across multiple processors. I think the correct value is 1.
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 see. But then looking at the actual redistribute function code, it has this:
While I don't fully understand what exactly is done with
BuildRedistributeMask
, it seems to me that it determines the neighboring ranks to which particles could be passed / received from.Is it correct then to say that even with
local=1
there would still be some unnecessary overhead but that overhead will be minimized compared to the case where particles could be globally redistributed?This really makes a case for having a function that simply, locally, removes invalid particles.