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

New user question: checking use case #583

Closed
a-jp opened this issue Oct 21, 2022 · 7 comments
Closed

New user question: checking use case #583

a-jp opened this issue Oct 21, 2022 · 7 comments
Labels
question Further information is requested

Comments

@a-jp
Copy link

a-jp commented Oct 21, 2022

Hi,

I've come across Cabana and it looks like I could use a subset of it for my use case. I've asked a very similar question on the ArborX project, and I would like to explore Cabana in a similar vane. Could I describe my use-case and would you be able to confirm that it's an appropriate library? I'd ideally like to do the following:

In advance there is no notion of a mesh/grid for my use case. I'm happy to bound the problem to a domain if needed (xmin/xmax etc), but fundamentally my question relates to a meshless problem. I understand I may need an underlying grid but from my point of view that’s only to serve particle based operations.

  • Read in a list of points (x, y, z) and add them to Cabana. I guess the question here is, if run mpi 2-way, do I read 50% per processor myself, or can the library auto-partition the initial list as it sees fit? Or both?
  • Add variables to each point. Ideally scalars (doubles) and simple vector types (Eigen say), but I'm more than happy with a simple tuple of 3 doubles (thinking velocity here). I'd need to be able to add integer types also to each point as field variables. Is all of this possible?
  • Loop over all points: for each point (already added), find the closest N particles/neighbours? So what I do not want is for a given random xyz, find the closest N particles/neighbours already added. What I need instead is the closest N points already added, for a given particle that has already been added. If that makes sense, is the latter possible?
  • If the above can work the way I need it, just confirming that parallel N-neighbour search works via MPI, which is my parallel use-case here (interest in OpenMP too), but mainly MPI?
  • I need n-neighbours per point, not points within a radius. If the latter is implemented, is it possible to vary the radius per point differently, such that exactly 'n' can be found? In parallel?
  • Once the parallel N-neighbour search can be done, for a given existing point already added and returning its N-neighbours, can I access the field variables that I have assigned to those N-neighbours points, again, in parallel? So the neighbour may be on other proc and I want the knowledge of that neighbour, which is remote, and to access its remote field variables also?
  • For a given i and j pair, say i is my point of interest and j has been returned as one of i's neighbours: I need to be able, in parallel, to read from i and j (gather), perform a computation once for that pair and write to different storage located/associated at i and j the computed value (scatter), again in parallel. Is this type of paired i-j gather/scatter possible in parallel?

Currently, I do the above in serial only with the point-locators and associated data-structures in VTK. I'd like to do the above with MPI, with data held per point, and the associated parallel read and write to the data held at each point along with the parallel N-neighbour search, where the search is conducted for the neighbours of an existing point.

Sorry for the long post. Many thanks for the help,
ajp

@sslattery
Copy link
Collaborator

Hi @a-jp - this seems like a better job for ArborX because you want k-nearest neighbors. Cabana uses ArborX for spatial intersection searches (i.e. all points within some distance) based on your n-neighbors requirement it will likely not have the right search ability for you. ArborX should have a parallel k-nearest search.

@a-jp
Copy link
Author

a-jp commented Oct 21, 2022

Ok thanks. The parallel gather/scatter on a i-j pair is I believe the issue for my use cases when using ArborX?

@sslattery
Copy link
Collaborator

Yes - one thing we could do though is add a k-NN neighbor list to Cabana that uses ArborX. Or you could use them in concert. @dalg24 @streeve what do you think?

@masterleinad
Copy link
Contributor

From the ArborX perspective, you can obtain the field variables (and their MPI rank) for the neighbors of a given point and then do some computation on that with arborx/ArborX#737. The scatter part you would need to implement yourself.

@a-jp
Copy link
Author

a-jp commented Oct 21, 2022

ok, thank you, I guess we're using the wrong project really to discuss ArborX, but thanks. From my point of view, I'd have no idea how to implement the scatter part. Are there any places to start to help with that?

@streeve
Copy link
Member

streeve commented Oct 21, 2022

So right now in Cabana I think we have everything you need except the kNN part. We don't have a direct MPI neighbor search, but we instead assume you have already done a gather first, then include potentially ghosted particles in the local neighbor search. So you can do gather/scatter on particles and the neighbor search, just in separate kernels. So the relevant examples would probably be AoSoA (for your particle fields question), neighbor list (again currently fixed radius, but could be extended to kNN), and halo

If we did add kNN it sounds like the first route would probably be another wrapper around ArborX

@streeve streeve added the question Further information is requested label Nov 3, 2022
@streeve
Copy link
Member

streeve commented Jan 12, 2023

Feel free to reopen to ask a follow-up or related question or open a new issue as needed

@streeve streeve closed this as completed Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants