thermochimica icon indicating copy to clipboard operation
thermochimica copied to clipboard

Reduce dynamic memory allocations

Open parikshitbajpai opened this issue 1 year ago • 2 comments

Reason. Dynamic memory allocation such as in PolyRegularQKTO takes a significant amount of time such as in the example below.

Proposed Solution Reserve enough memory at start of program? A proper solution will obviously need more thought and a redesign of the code (or just use Yellowjacket-GEM 😅)

Impact Faster multiphysics

Additional context image

parikshitbajpai avatar May 11 '23 17:05 parikshitbajpai

Any fortran array with a size that is dependent on a runtime variable will lead to a malloc/free pair. The profile shows that > 30% of the Thermochimica time is spent in either malloc or free. At first glance it looks like those could largely be avoided by reusing buffer space (sized for the maximim number of species in a given phase for example).

dschwen avatar May 11 '23 19:05 dschwen

@markuspiro any suggestions?

parikshitbajpai avatar May 18 '23 23:05 parikshitbajpai