I am using Debian Linux with te ifort version 10.1 and am developing a procedure for scientific purposes that explores a cluster of elements on some sort of a mathematical graph and extracts some information about that cluster. The procedure is recursive and it works fine up till some limiting size of the cluster (about 500000 elements in the cluster). When the size is exceeded the stack overflows and the program breaks. I am aware that it has to break at some point and I am fine with that, but what I do not understand is the fact that I can not postpone this ocurrence. What it says is:
"forrtl: severe (174): SIGSEGV, segmentation fault occurred"
I first I have reduced considerably the variables in the recusrsive procedure and it did not help at all, secondly I have tried to send instructions to "ld" to increase stack size by including a switch "-Xlinker --stack xxx" in the ifort command and it said "ld: unrecognized option '--stack'" which is curious since that switch can be found in the man pages of ld. The third thing I tried is using "ulimit -s unlimited" command and hence increased the stack size within bash - still no help to my problem. And one more thing, I am pretty sure that none of my integer variables exceed their max values.
The curious thing is that the program uses the same amount of ram in all the cases which is much less (150mb) than the amount of ram on my computer at the time it breaks. I wonder why does he not allocate the additional ram if he needs it? I was wondering if somebody has some insight in the way the recursive subroutines compile with ifort and has a solution of some sort. Remember, I do not need magic, I just want it to break because it has no more ram available if it has to break because of something :). I would rather not have to decompose the thing in do loops if I can somehow increase the available memory by manipulating ifort and/or linker commands.
Thanks very much in advance, Ivan Balog.