Closed giovanni-rosotti closed 7 years ago
This improvement should be synced together with the MPI particle transfer, i.e. so instead of doing particle reorderings separately (sink accretion, MPI particle transfer, reordering for better cache performance), we perform this once per tree re-build step. Dead (i.e. accreted) particles can be left where they are in the array, but with a zero mass, until the main reordering event removes them completely.
Code is written, but not properly and automatically hard-wired into code. Also, should be possible to have reordering of main particles independently of any ghosts (need to merge MPI branch first)
I believe the code currently does what is suggested above, i.e. dead particles are now effectively removed by swapping them with the last 'alive' particle in the array using the DeleteDeadParticles function. The 'ReorderParticles' function still exists but is not called anywhere. And I don't think there are any MPI ghost issues anymore (if I'm not mistaken) so in principle this issue has been resolved and can be closed.
The only possible remaining issue is array re-ordering to the tree-walk order is still not done which could bring some additional benefits (although not as much as SEREN or GADGET since we get most of our memory benefits from local copies of neighbours with cell walks). However, this could be opened as a separate issue/enhancement!
I can confirm that ReorderParticles is no longer used. Also the iorder array is no longer used. Therefore I removed them in commit 3358261 as they were only unnecessary junk. I'll now close this issue
The ReorderParticles in the Sph class needs to be optimized. At the moment it allocates temporary arrays to hold all the particles, copies all information to them and then copies back to the main array only the particles still alive. An obvious optimization would be to switch dead particles with the last ones in the array. This is not parallelizable, but it is surely faster than what we are doing now