dougshidong / PHiLiP

Parallel High-Order Library for PDEs through hp-adaptive Discontinuous Galerkin methods
Other
45 stars 36 forks source link

`diffusion_exact_adjoint` using memory for unrelated tests #218

Open jbrillon opened 1 year ago

jbrillon commented 1 year ago

There is memory usage coming from diffusion_exact_adjoint.cpp in unrelated tests. I've attached the massif file and parameter file (.txt since I cannot attach a .prm on GitHub) used for running this: valgrind --tool=massif "/home/julien/Codes/2023-02-15/PHiLiP/build_debug/bin/PHiLiP_3D" "-i" input.prm

input.txt

image

dougshidong commented 1 year ago

From what I see, it is related to static initializations of CodiPack. Let's pretend that diffusion_exact_adjoint did not exist. This memory would still be used by CodiPack. It would just occur elsewhere when CodiPack first appears in terms of initialization.

I removed diffusion_exact_adjoint from test.cpp, and the next time PHiLiP's next first encounter with CodiPack is in dg.cpp Screenshot from 2023-04-26 18-25-17

Is there any reason for the concern for this amount of memory (174mb)? Have you noticed it grow according to problem size? Otherwise, we can mark it as expected behavior.

I believe CodiPack has been updated in the past few years as well. Worth pulling in the latest version by updating the commit the submodule points to:

https://github.com/dougshidong/PHiLiP/tree/master/submodules

dougshidong commented 1 year ago

The __GLOBAL You can notice this by using gdb on a test.

rbreak diffusion_exact_adjoint.cpp
run

You'll see that it breaks during program initialization.

The answer is somewhere in there: https://stackoverflow.com/a/69837439

I don't fully understand it, but I understand that this memory utilization will occur no matter what for the current CodiPack. Best person to talk to is the developer of CodiPack who is pretty friendly.