I have an issue regarding stacksize and ifort (Parallel Studio XE Composer). For my computations I divide an huge array into small pieces and every node submitted to the run does the computations for one part. Below a chunk of code:
real :: p(200,200,400) integer :: ib,ie,jb,je,kb,ke ... ib=1;ie=199 jb=2;je=198 kb=2;ke=398 call SOLVE_POI_EQ(rank,p(ib:ie,jb:je,kb:ke),R)
The problem here is that when I reduce the number of nodes, the code crashes with an `Segmentation Fault` when I call `SOLVE_POI_EQ`. I use linux and when I set the stack size to unlimited: `ulimit -s unlimited` it works.
I'm now worried that I overwrite parts of my OS (can that happen?)!
Is there a better way to address this issue?
You will never overwrite parts of the O/S. Your application runs in Virtual Memory.
Fortran has an option to place large local objects in the heap. -heap-arrays [size] (Linux), /heap-arrays[:size] (Windows)
>>>I'm now worried that I overwrite parts of my OS (can that happen?)!>>>
As Jim said it will not happen.
I think that in your case running program simply consumed all allocated stack space thus triggering segmentation fault when addresses range being referenced where mapped to reserved or uncommited memory.
>>>Perfect so no reacent to worry about killing my os or slowing the code down. Thanks!>>>
Unless you will start writing kernel code and overwrite somehow critical structures:)
Intel advice from not too long ago recommended against using heap inside OpenMP parallel regions. Then it seems there have been some efforts made to help out with this combination. So I don't know the latest word.
You can also have an allocation that succeeds (returns non-null pointer), and then have the error occur later when the allocation is use as a first time use, which then causes a page fault should the page file become exhausted. IOW allocation works - program fails due to lack of resources.