open-AIMS / ADRIA.jl

ADRIA: Adaptive Dynamic Reef Intervention Algorithms. A multi-criteria decision support platform for informing reef restoration and adaptation interventions.
MIT License
14 stars 5 forks source link

Improve summarize performance by using mapslices #862

Closed Zapiano closed 1 week ago

Zapiano commented 1 week ago

The previous approach, using JuliannedArrays.Slices, is taking too much to run for some unknown reason. Using mapslices seems to fix the problem.

closes #788

Zapiano commented 1 week ago

@ConnectedSystems @BG-AIMS I've changed the approach here, going back to JuliennedArrays, and now it's much faster than with mapslices (as mentioned here: https://github.com/open-AIMS/ADRIA.jl/issues/788#issuecomment-2373154482 )

Zapiano commented 1 week ago

Just to give an idea:

Using mapslices: image

Using JuliennedArrays with read(): image

Zapiano commented 1 week ago

@ConnectedSystems I still have to test this, but I tried dynamically determining if there's enough space to read(data). Let me know if that's what you were thinking.

Zapiano commented 1 week ago

Quick comment: I changed the threshold to be 70% of available space in RAM, to have a safety margin to account for memory spikes and other unpredicted memory usages that could cause a problem.