|
[Sponsors] |
April 4, 2005, 14:42 |
Segmentation Fault
|
#1 |
Guest
Posts: n/a
|
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 |
|
April 4, 2005, 15:06 |
Re: Segmentation Fault
|
#2 |
Guest
Posts: n/a
|
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. |
|
April 4, 2005, 15:18 |
Re: Segmentation Fault
|
#3 |
Guest
Posts: n/a
|
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. |
|
April 5, 2005, 07:01 |
Re: Segmentation Fault
|
#4 |
Guest
Posts: n/a
|
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. |
|
April 5, 2005, 08:37 |
Re: Segmentation Fault - Q: MEMORY
|
#5 |
Guest
Posts: n/a
|
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 |
|
April 5, 2005, 09:09 |
Re: Segmentation Fault - Q: MEMORY
|
#6 |
Guest
Posts: n/a
|
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.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[OpenFOAM] Paraview - Segmentation fault | grjmell | ParaView | 5 | January 9, 2024 14:14 |
Segmentation fault when running dieselFoam or dieselEngineFoam in parallel | francesco | OpenFOAM Bugs | 4 | May 2, 2017 22:59 |
Debugging a segmentation fault? | hansel | OpenFOAM Bugs | 3 | July 31, 2010 14:13 |
ParaView segmentation fault only for multiphase | gwierink | OpenFOAM | 9 | March 25, 2010 08:23 |
KIVA and Segmentation Fault | Felix | Main CFD Forum | 2 | January 18, 2006 02:24 |