Skip to content

P3M Merge #334

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

Open
wants to merge 153 commits into
base: master
Choose a base branch
from
Open

P3M Merge #334

wants to merge 153 commits into from

Conversation

tischwab0911
Copy link

Pull request to merge the P3M codes into the main repository.

@aaadelmann aaadelmann self-requested a review February 11, 2025 18:20
@aaadelmann
Copy link
Member

Why did you add the plot's? In general pdfs of results should not be in the repo. Are these plots used in your thesis?

Copy link
Collaborator

@aliemen aliemen left a comment

Choose a reason for hiding this comment

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

I skimmed a bit over the code (I won't have time to actually understand the solver itself until in two weeks...). But here are a view comments:

  • I agree @aaadelmann, I think we should remove the plots/... and python_scripts/... folder for the merge., since they are not part of the solver itself?
  • The files under test/p3m/... seem nice, and I think they could also easily be converted into unit tests.
  • I added a view suggestions above concerning the code/file structure. I think, it might make sense to make an effort in keeping it consistent with the existing structure (mainly regarding Alpine mini apps and manager classes):
    1. Remove the P3M3DManager, since it is basically the same as PicManager (just a suggestion, there might be room for debate here).
    2. Remove src/p3m/ and put P3MParticleContainer together with the high level P3M manager(s) into a alpine/p3m/... folder.

I have not yet looked into the alpine/[...]P3M[...] (or src/PoissonSolvers/P3MSolver[...]) classes yet, since (as mentioned) I don't fully understand the algorithm yet... But I suppose it is probably not necessary to look too much into it just yet for this merge?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this manager really necessary? If I am not wrong, then this is exactly the same as PicManager without the load balancer and with an additional par2par() method.

Also: this method seems to be a function that calculates actual interaction, so maybe, conceptually, it should not be part of a "manager" parent class anyways?

Copy link
Collaborator

Choose a reason for hiding this comment

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

P3M3DManager has its particle container fixed to P3MParticleContainer instead of having a template parameter or it. does this make it reason enough to have a separate class for it?

Comment on lines 7 to 9
using Device = Kokkos::DefaultExecutionSpace;
using NList_t = Kokkos::View<unsigned int *, Device>;
using Offset_t = Kokkos::View<int [14*3], Device>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be inside the class.

ippl::ParticleAttrib<double> Q; // charge
typename Base::particle_position_type P; // particle velocity
typename Base::particle_position_type E; // electric field at particle position
ippl::ParticleAttrib<double> phi; // electric potential at particle position
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe I did not find it, but is phi even used anywhere?

PLayout_t<T, Dim> pl_m; // Particle layout
NList_t nl_m; // NeighborList
bool nlValid_m; // true if neighbor list was initialized
bool *neighbors_m;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should neighbors_m be a smart pointer instead of a regular pointer?

Copy link
Collaborator

Choose a reason for hiding this comment

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

this should be an array of bools. what is the best datatype to do this? is a std::vector possible or should it be a Kokkos::View?

Comment on lines +46 to +48
double start = MPI_Wtime();
manager.run(manager.getNt());
double end = MPI_Wtime();
Copy link
Collaborator

Choose a reason for hiding this comment

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

This could be measured using IpplTimings.

@0xBachmann 0xBachmann self-requested a review March 19, 2025 12:54
@aliemen
Copy link
Collaborator

aliemen commented Mar 25, 2025

  1. Remove src/p3m/ and put P3MParticleContainer together with the high level P3M manager(s) into a alpine/p3m/... folder.

Update after todays IPPL Meeting: Let's not extend "alpine", but rather create a separate directory. Also: I think it would improve clarity if we created a new "examples" directory, where we put all these mini apps in. Maybe a folder structure like the following:

examples/
├─ alpine/
│  ├─ AlpineManager.h
│  ├─ ...
├─ collision/
│  ├─ P3M[...]Manager.hpp
│  ├─ P3MParticleContainer.hpp
│  ├─ datatypes.h
│  ├─ [...].cpp 
│  ├─ ...
├─ cosmology/
│  ├─ ...

Also I just notices you removed P3MParticleContainer.hpp (which is not what I meant above). I was thinking of removing P3M3DManager.h, since it is basically the same as the PicManager.h, but with a fixed particle container type. Since PicManager is templated on the container type, one can easily use it together with P3MParticleContainer.hpp.

@0xBachmann be carefule with the difference between a manager class and a container class ;):

  • Container only saves particle information (e.g. attributes like position, charge, mass) and their layout (e.g. "where on the machine"). On a high level, they should inherit from e.g. ParticleBase.
  • Managers manage the simulation. They hold the containers (particle/field) and all other tools (like the solver instance) and define what happens in the simulation every timestep. On a high level, they should inherit from PicManager for particle simulations.

Therefore, removing the only P3MContainer is not a good idea, it should be high level part of the "P3M mini apps". Removing the code duplication introduced by the P3M3DManager, which does not need to be a high level specialization, however, should improve clarity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants