Fortran 77 64bits large arrays linking relocation problems

Hi There,

This may be a trivial question but could not find the answer in the PGI doc. I am trying to compile a fortran 77 code which makes use of large arrays grouped in common block. The total allocation in several common block is about 10GB.
At link time I am getting the following error:

frgen3d_ipa22_gen3d_linuxPgi64bits.x.o(.text+0x520):frgen3d.f: additional relocation overflows omitted from the output
frgen3d_ipa22_gen3d_linuxPgi64bits.x.o(.text+0x29d7):frgen3d.f: undefined reference to yyw12_' frgen3d_ipa22_gen3d_linuxPgi64bits.x.o(.text+0x29fb):frgen3d.f: undefined reference to yyw12

frgen3d_ipa22_gen3d_linuxPgi64bits.x.o(.text+0x3d25):frgen3d.f: undefined reference to yyw12_' frgen3d_ipa22_gen3d_linuxPgi64bits.x.o(.text+0x3d33):frgen3d.f: undefined reference to yyw12_’
frgen3d_ipa22_gen3d_linuxPgi64bits.x.o(.text+0x3d41):frgen3d.f: undefined reference to yyw12_' frgen3d_ipa22_gen3d_linuxPgi64bits.x.o(.text+0x7362):frgen3d.f: undefined reference to yyw7_’
frgen3d_ipa22_gen3d_linuxPgi64bits.x.o(.text+0x736e):frgen3d.f: undefined reference to yyw7_' frgen3d_ipa22_gen3d_linuxPgi64bits.x.o(.text+0x73ea):frgen3d.f: undefined reference to yyw8_’
frgen3d_ipa22_gen3d_linuxPgi64bits.x.o(.text+0x8085):frgen3d.f: undefined reference to yyw7_' frgen3d_ipa22_gen3d_linuxPgi64bits.x.o(.text+0x8091):frgen3d.f: undefined reference to yyw7_’
frgen3d_ipa22_gen3d_linuxPgi64bits.x.o(.text+0x810d):frgen3d.f: undefined reference to yyw8_' frgen3d_ipa22_gen3d_linuxPgi64bits.x.o(.text+0x8480):frgen3d.f: undefined reference to yyw12_’
frgen3d_ipa22_gen3d_linuxPgi64bits.x.o(.text+0x8800):frgen3d.f: undefined reference to yyw12_' frgen3d_ipa22_gen3d_linuxPgi64bits.x.o(.text+0x8851):frgen3d.f: undefined reference to yyw12_’
frgen3d_ipa22_gen3d_linuxPgi64bits.x.o(.text+0x8b35):frgen3d.f: undefined reference to yyw12_' frgen3d_ipa22_gen3d_linuxPgi64bits.x.o(.text+0x8b3e):frgen3d.f: undefined reference to yyw12_'_

With Intel compiler, it is possible to compile such a code without the overflow by using -dyncom which allows for dynamic common block allocation. Is there any similar flag within the fortran 77 PGI compiler?

Forgot to mention that I am running 64bits suse9.3 on a dual opteron PC.
The compilation flags I am using are the following ones:

pgf77 -tp=k8-64 -fast -Mipa=fast -Mlarge_arrays -mcmodel=medium -O3

Thank you

Eric

Hi Eric,

We do not have an equivlent flag to “-dyncom”, however using the “-Mlarge_arrays -mcmodel=medium” flags should work. Are you linking with a static library? If so, the library’s objects should be compiled with either “-mcmodel=medium” of “-fpic” in order to be linked with an executable compiled with the medium memory model. Otherwise, there is a good chance that you’ll get relocation errors.

The output you provided contains mostly undefined reference errors. Have you been able to determine where these symbols are from? Are you missing an object or library from the link? Can you please post an example of the relocation error as well as any other errors that appear in the output along with the compiler version your using?

Also, let make sure that IPA isn’t causing a problem and compile with just “pgf77 -tp=k8-64 -Mlarge_arrays -mcmodel=medium”.

Thanks,
Mat

Thanks Mat for the quick feedback,

Well those YYW* common blocks are properly defined within the main routine of the solver I am compiling. Removing the IPA flag that I was using, solved the problem. I can now compile the entire code without much problems. I nevertheless have still a problem remaining.

The structure of the data is as follows: There are large integer and float arrays defined in the main routine and passed as parameters to teh various subroutines. Those arrays have also been placed into common block in order ot be able to compile the code using the Intel compiler. By doing so and using the -dyncom flag, we are able to compile the code requiring 20GB of RAM (out of which only 4GB are used) and run it on a 6GB machines under Suse 9.3. Note that common blocks are only setup to be able to use the -dyncom flag. If I remove the common block, recompile and try to run the code, I am getting a killed as the code is requiring more memory than the system has (real ram+swap). This is happening under Intel and PGI compiler. You mentioned the fact that the PGI did not have any such directive. Is there anything that might help me in runnning teh 20GB code on a 6GB machine knowing that only 4GB is used at a time?

Thanks

Eric

Hi Eric,

We do have an old extension for pgf77 which allows you to create allocatable common blocks (See PGI Fortran Reference Guide page 60). However, I doubt it will help here since you’ll still need to allocate the common block, and allocatating 20Gb will fail.

I don’t know how much work this would be for you but the best solution I can think of is to use F90 allocatable arrays instead of your current static large arrays. You would need to manage the memory using allocate and deallocate, but this way you would have better control over how much memory is being used and make your program more portable.

Hope this helps,
Mat