GEOS-DEV / GEOS

GEOS Simulation Framework
GNU Lesser General Public License v2.1
207 stars 83 forks source link

[EPIC]: Reduce Memory Footprint #2338

Open rrsettgast opened 1 year ago

rrsettgast commented 1 year ago

Description

We would like to reduce the memory footprint of GEOSX. There are several allocations that do not need to occur every simulation, and some redundant copies that should be eliminated.

Work Scope

XL64 commented 1 year ago

Hello, @rrsettgast Got an error after merging develop and running with -m 0.0, any clue what I did wrong ?

************************************************************************************************************************
Data repository memory allocations
                                                                                       min          max          sum
                                                                                   -----------  -----------  -----------
|
Received signal 11: Segmentation fault

 ** StackTrace of 7 frames **
Frame 0: ./bin/geosx
Frame 1: __kernel_sigtramp_rt64
Frame 2: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > 
geosx::stringutilities::toMetricPrefixString<unsigned long>(unsigned long const&)
Frame 3: geosx::dataRepository::printMemoryAllocation(geosx::dataRepository::Group const&, int, double)
Frame 4: geosx::GeosxState::initializeDataRepository()
Frame 5: main
Frame 6: /lib64/power9/libc.so.6
Frame 7: __libc_start_main
rrsettgast commented 1 year ago

@XL64 what problem are you running. what platform?

XL64 commented 1 year ago

I am on pangea3 (power9 + NV100) running ./acous3D_abc_smoke.xml with an increased size to 100x100x100 maxTime set to 0.01

    sed -i -e 's/{ 5 }/{ 100 }/g' acous3D_abc_smoke.xml                                                                                                                             |Cleaning up events
    sed -i -e 's/maxTime="0.2"/maxTime="0.01"/' acous3D_small_base.xml                                                                                                              |acousticSolver, number of time steps: 10
    mpirun -np 1 ./bin/geosx -i ./acous3D_abc_smoke.xml --trace-data-migration -m 0.0|| exit 1
XL64 commented 1 year ago

It's due to a log10( 0 ) in toMetricPrefixString when value == 0. I did that : int const power = (value == (T)0)?1:floor( log10( std::abs( (double)value ) ) ); and it's OK. Do you want me to do a PR or do you have a better solution ?

XL64 commented 1 year ago

It measures "only" host memory the -m 0.0 ?