CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   Segmentation Fault (http://www.cfd-online.com/Forums/main/8971-segmentation-fault.html)

Victor April 4, 2005 13:42

Segmentation Fault
 
I have a large (FORTRAN) CFD code compiling with G77. The OS of my machine is Linux-SuSE. The machine has 2GB memory. I get this error message (Segmentation Fault) when I increase the dimensions of the matrices.

1. Is that because of the compiler (g77) which is not able to use the full capacity of 2 GB memory,

2. OR, Linux causes sort of problem so the compiler cannot use the full memory,

3. OR, there is no problem with g77 and linux, but the memory (2GB) is not enough? If this is the case, how can I increase the memory, due to the linux limitation (2GB)?

If the problem could be a combination of two or all of these items, how can I track the problem to resolve this issue?

Appreciate any helpful idea.

Victor


cfd dude April 4, 2005 14:06

Re: Segmentation Fault
 
I might actually place bets on option 4, your code is accessing an invalid index in one of your arrays (i.e., the array index is zero or greater than the specified dimensions).

Try compiling with the options to check array bounds to verify this is or isn't the case.

cfd dude April 4, 2005 14:18

Re: Segmentation Fault
 
Actually, reading your post again, what sorts of matrix dimensions are we talking about? You can do a quick hand calculation to estimate the memory needed (4*N*N for integers or single precision reals, e.g.).

If N is big enough it may be that your code does exceed the available memory.

Steve April 5, 2005 06:01

Re: Segmentation Fault
 
If your matrices are not statically allocated you will run into memory problems. If this is the case, SAVE them in the subroutine that's declaring them.

Alternatively, use the gdb debugger to trap the seg fault in a debug compile version.

Al April 5, 2005 07:37

Re: Segmentation Fault - Q: MEMORY
 
Guys,

I found this dicussion interesting. I am new in CFD programing, how can I estimate the capacity of the memory (RAM) in MB or GB, needed for a program which has several matrices? For instance, for an array like AA(1000,1000,1000,1000), how much memory (RAM is needed), if AA is: 1. single-, or 2. double-precision? If the answer goes long, would you please give some references (preferably online)? I took a look at some FORTRAN books already, but couldn't find anything useful on this.

Thanks. Al

Márcio Ricardo April 5, 2005 08:09

Re: Segmentation Fault - Q: MEMORY
 
If (1000,1000,1000,1000) is the dimension of your array, you will need 1000X1000X1000X1000*sizeof(double) to allocate it. That is, 10e12*8bytes at least. For such size of arrays some sparse storage scheme to save memory is needed.


All times are GMT -4. The time now is 14:29.