You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On the distillation branch, Rob pointed out to me that there's a risk of stack overflow when using explicit shape automatic arrays, for example to declare an extra array for saving the composition in case it needs to be reset. (See discussion at a31cb38#r117329563.)
This was a construction I had copied over from predictive mixing, which makes even more extensive use of such automatic arrays:
@rhdtownsend do you think it would be worthwhile to refactor this code to use something more like the saved_data construction with allocatable arrays like in conv_premix?
The text was updated successfully, but these errors were encountered:
Does it help, though? Are we not just delaying the inevitable until there's an assignment of allocate statement? Or does an array being allocatable mean that only parts of it will go on the stack when needed (in which case I agree with using allocatable arrays)? I do find the explicit shapes help readability, though that can also be achieved in a comment.
I think this is compiler dependent, but I recall it being the case with gfortran that automatic arrays go on the stack, while allocatables go on the heap. Without user intervention (e.g., via ulimit), the stack is quite limited in size, so I can see a legitimate difference here.
cheers,
Rich
On Sep 14, 2023, at 8:10 AM, Warrick Ball ***@***.***> wrote:
Does it help, though? If the calculation is going to take that much memory, then that's that. I.e., are we not just delaying the inevitable until there's an assignment of allocate statement? Or does an array being allocatable mean that only parts of it will go on the stack when needed (in which case I agree with using allocatable arrays)? I do find the explicit shapes help readability, though that can also be achieved in a comment.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
--
Rich Townsend • Professor of Astronomy
Astronomy Department • University of Wisconsin-Madison
Phone: 608-262-1752 • E-mail: ***@***.***
On the distillation branch, Rob pointed out to me that there's a risk of stack overflow when using explicit shape automatic arrays, for example to declare an extra array for saving the composition in case it needs to be reset. (See discussion at a31cb38#r117329563.)
This was a construction I had copied over from predictive mixing, which makes even more extensive use of such automatic arrays:
mesa/star/private/predictive_mix.f90
Lines 719 to 735 in c3e28ef
@rhdtownsend do you think it would be worthwhile to refactor this code to use something more like the
saved_data
construction with allocatable arrays like inconv_premix
?The text was updated successfully, but these errors were encountered: