- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Many types of array operations create temporaries. Do try /heap-arrays.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page