SWIFTSIM / HBTplus

HBTplus halo finder adapted for the FLAMINGO and COLIBRE simulations
0 stars 0 forks source link

Distribute snapshot particles according to hash of the particle ID #24

Closed jchelly closed 2 months ago

jchelly commented 2 months ago

Currently HBT arranges snapshot particles for easy lookup by ID by putting different ranges of IDs on different MPI ranks. The algorithm used to determine the assignment of ID ranges to ranks seems to become very slow on hydro runs where the IDs are not a contiguous sequence.

This pull request modifies the code to distribute particles according to the hash of their ID. Assigning particles to ranks is then just done by rank = hash(id) % comm_size, which is simple and fast but we rely on the hash values being evenly distributed to ensure reasonable load balancing.

jchelly commented 2 months ago

I've also made some changes to avoid overflow and rouding issues in MyAlltoall() and added unit tests for MyAlltoall and Pairwise_Alltoall.

jchelly commented 2 months ago

There are some duplicate commits here due to reusing parts of the merger_tree branch. I'll close this and make a new PR.