It was a stack overflow.
I could remedy it by using
ulimit -s 2048000 (you can choose an appropriarte) number ... then changing the same in /etc/security/limits.conf (to have it changed permanently).
then export KMP_STACKSIZE=2048000000 (i chose very high value, since it is only a limit)
#include
#include
#include
#include
#include
void unlimit_stack_(void) {
struct rlimit rlim = { RLIM_INFINITY, RLIM_INFINITY };
if ( setrlimit(RLIMIT_STACK, &rlim) == -1 ) {
perror("setrlimit error");
exit(1);
}
}
Yes, a Fortran programmer who can write C too. and here's how to call it from Fortran:
Program main
external unlimit_stack
call unlimit_stack()
...etc...
end
Hope this helps. If not, I have some code to determine at runtime the stacksize seen by your program.
-------------------------------------------------------------
另一个关于Segmentation fault的帖子。