Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Stack overflow issue

OP1
New Contributor III
851 Views

The following line in my code creates a stack overflow:

J(1:N,1:M) = J_COARRAY[IMG]%VALUES

VALUES is a rank 2 array with dimensions smaller than those of J. The compiler is set so that warnings are issued when temporary arguments are created (which I suppose, is not really the case here since no warnings were issued). Does the transfer of data from one image to an other requires the creation of a temporary buffer (which would cause the stack overflow)?

I suppose the work around is to allocate arrays on the heap then?
 

0 Kudos
3 Replies
Steven_L_Intel1
Employee
851 Views

Many types of array operations create temporaries. Do try /heap-arrays. 

0 Kudos
OP1
New Contributor III
851 Views

Thanks Steve,

Now I run into a somewhat tricky issue. My program has the following lines:

CALL SOLVER(...)
WRITE(*,*) 'I am out!'

which is called by all coarray images. The last statement inside SOLVER is a WRITE(*,*) to indicate that all images are exiting.

What happens is that all images indicate that they are exiting SOLVER; but none executes the WRITE statement immediately outside of it and the code just stops, without any error message. This behavior only happens for a Release version, not Debug, and only when using /heap-arrays. If not using /heap-arrays, then both Release and Debug versions run properly (the stack overflow in the Release version due to manipulation of large arrays happen much much later in the code - it doesn't happen in the Debug version).

I am a bit at a loss regarding where to start for debugging. If I add additional WRITE statements to help troubleshoot, the code will go 'a little further' but will still stop. Any suggestions regarding how to get out of this? What should I look at next?

0 Kudos
Steven_L_Intel1
Employee
851 Views

I agree that debugging coarray applications can be very difficult. What you write makes me wonder if there's some error happening in one or more of the images that is corrupting memory. The way I usually attack such issues is to start removing code to see how that affects the symptom.

0 Kudos
Reply