adaptive-cfd / WABBIT

Wavelet Adaptive Block-Based solver for Interactions with Turbulence
https://www.cfd.tu-berlin.de/
GNU General Public License v3.0
55 stars 27 forks source link

Major: reworked synchronize ghost, performance gain visible and more clarity #57

Closed Arcadia197 closed 5 months ago

Arcadia197 commented 5 months ago

In preparation to give synchronize ghosts more flexible ways of synching I deep dived into the current implementation.

I noticed the following:

I reworked the structure and now we do the following:

  1. Loop over all neighbor relations and apply synching logic, save all metadata in one array (meta_send_all). Keep track of the sizes for metadata and data as before.
  2. Loop over meta_send_all and fill the sendBuffer with the necessary data. Here we save for each processor:
    • first entry is the amount of patches we synchronize with this processor
    • afterwards follows all metadata, we need send_hvy_id, neighborhood, level_diff and data_size, possibly rank for development
    • after that we have all actual data
  3. Do the transfer logic as before but only transfer the one buffer from which we then extract the metadata and data
  4. Internally loop over meta_send_all and copy if this neighborhood relation is internal

This enables us to:

Performance gain is visible, easy tests show 15% with blob_adaptive_2D_CDF62 which I normally use. I know 62 is probably not representative but probably this scales anyways better in 3D?

Arcadia197 commented 5 months ago

Additionally, I thought about the no-stage synching along the way with correcting internally. Are you sure this can be made working? If I look at it for example with CDF42 there should be points missing without enlarging the boundary. In the attached pdf the left orange point cannot be reconstructed on the receiver side without more points. Obviously we could send different points from the coarse side but this would be really tedious at the edges with reconstruction with level difference. Am I missing something? To be discussed together ..

synch_ghost_stagefree_CDF42.pdf

Arcadia197 commented 5 months ago

Also just dumping my ideas that I had to implement new ways of synching:

Arcadia197 commented 5 months ago

As further tests showed no direct benefit I will close the PR for now as I would like to push further work into my branch and it is to be merged later.