sandialabs / compadre

Compadre (Compatible Particle Discretization and Remap)
Other
22 stars 6 forks source link

Extract _target_coordinates and _source_coordinates as PointData classes #215

Open kuberry opened 4 years ago

kuberry commented 4 years ago

Implementation of this class will be used as a template for extracting other view access from the toolkit and replacing it with objects.

This issue deals with both the PointData class as well as its use in the GMLS class.

To date,

a view is passed by the user to the GMLS class. If template arguments match, the view is shallow-copied. If they do not, even if data lives on the same device, then a deep copy is made.

If point information were requested from the GMLS class, then there are two questions that need to be addressed regarding the implementation.

  1. Should the data inside of the PointData class be able to be changed by the PointData instance given to GMLS? It continues to persist outside of it being sent to GMLS. The user could change it, and if so, what should happen to the instance inside of the class?

  2. How should the information in the PointData class be made available through an accessor?

Issues with current approach

Solution should:

Path forward:

This gives the best of both worlds in the sense that by default, no deep copies will be made and only one copy of the coordinates will exist (unless someone modifies the original PointData instance). However, if the original instance of PointData is changed after sharing, then it resizes, reallocating memory and causing a second instance to exist.

kuberry commented 2 years ago

In order to speed up parallel computation, it was necessary to modularize the source and target coordinates as well as neighbor lists into a struct called PointConnections. To keep the functor size light, this struct does not manage host/device data relations, and instead is entirely on the device.

Future work can still be done in allowing a PointConnections object to be provided to the GMLS instance, but the host to device copy should be done in the PointConnections object prior to setting it.