CyprienBosserelle / BG_Flood

Numerical model for simulating shallow water hydrodynamics on the GPU using an Adaptive Mesh Refinment type grid. The model was designed with the goal of simulating inundation (River, Storm surge or tsunami). The model uses a Block Uniform Quadtree approach that runs on the GPU but the adaptive/multi-resolution/AMR is being implemented and not yet operational. The core SWE engine and adaptivity has been inspired and taken from St Venant solver from Basilisk and the CUDA GPU memory model has been inspired by the work from Vacondio _et al._2017)
GNU General Public License v3.0
34 stars 15 forks source link

Netcdf a100 #101

Open CyprienBosserelle opened 10 months ago

CyprienBosserelle commented 10 months ago

Save to file takes too long for many blocks

The problem

The current dev branch save each block independantly to the netcdf file. The bottleneck is the netcdf write function overhead which make writing large model (20000 blocks and more) quite slow.

The solution

To alleviate this needs a new function that combines all blocks in a single array (for each level/variable) and write the whole array at once to the netcdf file.

Hold on

While this will be faster, it is likely inefficient when there are few arrays in a level. Typically when the highest level has only a few block we would still be writing a full array.

Memory is cheap?

This will also be impossible if going to very high level where we won't be able to allocate memory to hold the highest level array.

The real solution

Something that combine both option above and decide what is the best compromise.

Collapse array

This may be a good time to introduce collapsing level to a single array and saving it to disk.

Other things

This branch also includes:

CyprienBosserelle commented 9 months ago

Added a new variable savebyblk input parameter. default is on if set to off it will save per level which is a lot faster but that require enough memory to allocate the full high res level.

CyprienBosserelle commented 9 months ago

No testing has been done for zoneoutput

CyprienBosserelle commented 4 months ago

This is on-hold until testing with new bnd complete