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

added a workaround for issue 4604 #4631

Closed
wants to merge 1 commit into from
Closed

Conversation

guj
Copy link
Contributor

@guj guj commented Jan 23, 2024

Guard against BTD case:

  • 0 particles are written at the last flush step (due to fraction = 0)
  • offset > 0 (particles do exist although not selected)

See issue #4604

@guj guj requested review from ax3l and RemiLehe January 23, 2024 21:43
@ax3l ax3l self-assigned this Jan 24, 2024
@ax3l ax3l added bug Something isn't working bug: affects latest release Bug also exists in latest release version component: diagnostics all types of outputs component: boosted frame boosted frame components & logic labels Jan 24, 2024
Comment on lines 711 to 714
if (is_last_flush_to_step) {
SetupPos(currSpecies, NewParticleVectorSize, isBTD); // workaround for issue 4604
SetConstParticleRecordsEDPIC(currSpecies, NewParticleVectorSize, charge, mass);
}
Copy link
Member

@ax3l ax3l Jan 24, 2024

Choose a reason for hiding this comment

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

I am not sure this should go exactly like this here.

What do you think about this?

Suggested change
if (is_last_flush_to_step) {
SetupPos(currSpecies, NewParticleVectorSize, isBTD); // workaround for issue 4604
SetConstParticleRecordsEDPIC(currSpecies, NewParticleVectorSize, charge, mass);
}
if (is_last_flush_and_never_particles) {
SetupPos(currSpecies, NewParticleVectorSize, isBTD);
}
if (is_last_flush_to_step) {
SetConstParticleRecordsEDPIC(currSpecies, NewParticleVectorSize, charge, mass);
}

Copy link
Member

Choose a reason for hiding this comment

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

Admittedly, this is exactly what is done a few lines earlier, isn't it? Why is that not called, I wonder.

Copy link
Member

Choose a reason for hiding this comment

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

What are the values of num_dump_particles and ParticleFlushOffset for this problem?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

num_dump_particles=0
ParticleFlushOffset=1000

so is_last_flush_and_never_particles (= is_last_flush_to_step && num_dump_particles == 0 && ParticleFlushOffset == 0) will be false.

Copy link
Member

@ax3l ax3l Jan 29, 2024

Choose a reason for hiding this comment

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

Thanks, got it.

If ParticleFlushOffset > 0 that means at some point, at least one rank had particles to write.

We need to check if maybe in the call where we write particles (earlier), we have a logic mistake that forgets to call SetupPos collectively.

Copy link
Member

@ax3l ax3l Jan 29, 2024

Choose a reason for hiding this comment

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

Hm, maybe we filter twice and forget num_fraction in one case? Let's take a look where num_fraction is applied and if the counter is done correctly afterwards.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My understanding is that the offsets are set in the BTD object, and when it calls flush(), the filters are then applied in the underlying flush formats during copyParticles(). Unlike other filters, the random filter affected the offsets of the caller BTD object.
I think the workaround is the easy and harmless. Otherwise, have to collect the particles written from all processes and update the offset in BTD.

Copy link
Member

@ax3l ax3l Jan 29, 2024

Choose a reason for hiding this comment

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

I think the workaround is the easy and harmless.

I would rather like to fix the underlying issue in the BTD offset counter. We need consistent meta data.

cc @RevathiJambunathan :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If it makes sense, can apply the random filter before BTD calls flush(). It will make things cleaning and easier.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, we probably need to add this to:

  • full diags
  • BTD
  • scraping

@guj
Copy link
Contributor Author

guj commented Jan 24, 2024

Not sure why it fails during "copying files to run directory..."

@ax3l
Copy link
Member

ax3l commented Jan 31, 2024

Fixing the broken meta-data in #4657 :)

@ax3l ax3l closed this Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: affects latest release Bug also exists in latest release version bug Something isn't working component: boosted frame boosted frame components & logic component: diagnostics all types of outputs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants