- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello. I have a code that was running just fine. Then, I increased the size of my arrays largely and it sometimes doesn't compiles and I tried with some flags that compiled but crashed with errors I don't understand.
I had some arrays of size about 3000, that I changed to 22554 ( and also squared matrices of this size). I have only my main code and a module, in which I create most of my global variables.
I was originally compiling just with:
ifort -c global_param.f90; ifort -c dyn.f90; ifort global_param.o dyn.o -check bounds
And for that I got the error during compiling:
global_param.o: In function `global_param_mp_hamiltonian_': global_param.f90:(.text+0x145): relocation truncated to fit: R_X86_64_32S against symbol `global_param_mp_pot1_' defined in COMMON section in global_param.o global_param.f90:(.text+0x14e): relocation truncated to fit: R_X86_64_32S against symbol `global_param_mp_pot1_' defined in COMMON section in global_param.o global_param.f90:(.text+0x173): relocation truncated to fit: R_X86_64_32S against symbol `global_param_mp_pot1_' defined in COMMON section in global_param.o global_param.f90:(.text+0x1d9): relocation truncated to fit: R_X86_64_32S against symbol `global_param_mp_pot1_' defined in COMMON section in global_param.o global_param.f90:(.text+0x1e3): relocation truncated to fit: R_X86_64_32S against symbol `global_param_mp_pot1_' defined in COMMON section in global_param.o global_param.f90:(.text+0x212): relocation truncated to fit: R_X86_64_32S against symbol `global_param_mp_pot1_' defined in COMMON section in global_param.o global_param.f90:(.text+0x22c): relocation truncated to fit: R_X86_64_32S against symbol `global_param_mp_pot2_' defined in COMMON section in global_param.o global_param.f90:(.text+0x236): relocation truncated to fit: R_X86_64_32S against symbol `global_param_mp_pot2_' defined in COMMON section in global_param.o global_param.f90:(.text+0x25a): relocation truncated to fit: R_X86_64_32S against symbol `global_param_mp_pot2_' defined in COMMON section in global_param.o global_param.f90:(.text+0x2c0): relocation truncated to fit: R_X86_64_32S against symbol `global_param_mp_pot2_' defined in COMMON section in global_param.o global_param.f90:(.text+0x2ca): additional relocation overflows omitted from the output
The I searched and found out that this could be due to the size of my arrays, and that I should compile with the -fpic and -mcmodel flags. So, I tried:
ifort -c global_param.f90 -fpic -mcmodel=large ;ifort -c dyn.f90 -fpic -mcmodel=large ; ifort -fpic -mcmodel=large global_param.o dyn.o -check bounds
And then I simply got the error
Segmentation fault
I don't know what to do. Can someone please help me?
Many thanks in advance,
Cayo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Make the large/huge arrays allocatable (then allocate at program start).
Jim Dempsey
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Make the large/huge arrays allocatable (then allocate at program start).
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Jim Dempsey,
Thank you for your suggestion. It helped, but now I have a new problem. One of my variables is a matrix with dimensions of (67662,67662).
I did the allocation in the beginning of all my big arrays as you suggested, including this big matrix. The program now crashes when I try to give it a value. I simply do:
Ha(:,:)=0.d0
and the program crashes just there with the error:
forrtl: severe (174): SIGSEGV, segmentation fault occurred Image PC Routine Line Source libifcoremt.so.5 000014B60BB792D6 for__signal_handl Unknown Unknown libpthread-2.27.s 000014B609F06890 Unknown Unknown Unknown dyn.exe 0000000000403707 Unknown Unknown Unknown dyn.exe 000000000040610B Unknown Unknown Unknown dyn.exe 0000000000400D8E Unknown Unknown Unknown libc-2.27.so 000014B609B24B97 __libc_start_main Unknown Unknown dyn.exe 0000000000400C7A Unknown Unknown Unknown
What should I do now?
Again, many thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oh, I just did Ha=0.d0 instead of Ha(:,:)=0.d0 and it worked.
Thanks for the help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You should report this as a bug. Both syntaxes should work. (include your system info and IVF version information too).
They are going to ask you for a reproducer too. See if this breaks on your system, if so, use this as the reproducer
! BigArray.f90 program BigArray implicit none real(8), allocatable :: Ha(:,:) allocate(Ha(67662,67662)) Ha(:,:) = 0.d0 ! whereas Ha = 0.d0 works print *, shape(Ha) end program BigArray
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Remember you are constrained by the physical memory of your computer. AND possibly stacksize limits for array temporaries.
67662^2 is 4.578146e9 which is 4.6 giga-elements. With single precision you need 18.4GB. double again for Double and you're over 36GB
so in Linux you would hope the allocate would fail if you need too much memory. Nope, linux uses lazy allocation so you don't really touch that memory and allocate it until you first need it, which is the Ha(:,:) = 0.0_4 or 0.0_8 initialization. If you don't have enough physical RAM and swap space BLAMMO! seg fault on that first touch.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As a side note, static arrays are stored in a 2GB segment along with code. Hence the initial compile errors when you exceeded 2GB in arrays.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes Ronald, you are correct. With all the others variables in my code, it is actually almost 70GB of ram.
This 2GB thing you mentioned I saw somewhere else, and that why I included the -fpic and -mcmodel=large flags.
![](/skins/images/D2683F18326913BBA0436CB7114DD569/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page