Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce Memory usage #33

Open
stoiver opened this issue Dec 18, 2022 · 5 comments
Open

Reduce Memory usage #33

stoiver opened this issue Dec 18, 2022 · 5 comments

Comments

@stoiver
Copy link

stoiver commented Dec 18, 2022

@uniomni , @PetarMilevski, @rudyvandrie

ANUGA is quite a memory hog. For instance when running run_parallel_rectanguar.py (from the examples/parallel directory) with varying --sqrtN values, using a command like::

mpiexec -np 2 time -f "User = %U s System = %S s Maximum RSS = %M kB" python -u run_parallel_rectangular.py --sqrtN 750

we obtained the following results

sqrtN no of triangles process 0 RSS memory User Time
250 250_000 710 MB 6 s
500 1_000_000 2.5 GB 34 s
750 2_250_000 5.1 GB 118 s

We can see very large memory usage for not so large number of triangles. So for a 100_000_000 triangle simulation we would be looking at processor 0 needing 250 GB.

An obvious place to save on memory usage would be to rationalise the memory usage of the Quantity objects. At present we store centroid, edge, vertex and 2 work arrays of size no of triangles. This means 9 x no of triangles. We should be able to get away easily with just centroid, edge and a work array for 5 x no of triangles. A saving of 5/9

Also we store numerous quantities, such as stage, height, elevation, xmom, ymon, xvel, yvel, friction. Probably only need stage, elevation (or height), xmom and ymom. Ie as saving of 4/8.

So total savings could be 5/9 x 4/8 = 20/72 ~ 3/10

To go forward with trying to reduce memory usage, I think it would be necessary to just work with the DE algorithms. An idea would be with say version 4 of anuga we could remove all the old algorithms, and just concentrate on a stream lined version of anuga just using the DE algorithm.

Thoughts?

@PetarMilevski
Copy link

PetarMilevski commented Dec 18, 2022 via email

@rudyvandrie
Copy link

rudyvandrie commented Dec 18, 2022 via email

@samcom12
Copy link
Collaborator

samcom12 commented Feb 3, 2023

Hi @stoiver ,

In our simulation we are just using DE1 algorithm. Can you give me some hints so as to reduce memory consumption before you make it available in next ANUGA release (4.0.0) ?

Cheers,
Samir

@stoiver
Copy link
Author

stoiver commented Feb 4, 2023

Hi @samcom12,

I haven't measured this, but I would think you could halve the memory (on processor 0) by first running a sequential job which creates the sequential domain and dumps the partition, and then run a parallel job which reads in the partition and sets BC etc and then runs the evolve loop.

There is example code in examples/parallel in particular the scripts run_sdpl_rectangular_create_partition_dump.py and run_sdpl_rectangular_load_evolve.py.

As regards reducing memory in the Quantity class, this will be quite a tricky task, so I think you should leave it to us, unless you have a programmer who has some time to work on this. Probably a month of work full time for someone new to ANUGA.

@uniomni
Copy link

uniomni commented Feb 5, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants