I've read though other posts that seem to indicate a lot of
confusion on the use of -fpic/fPIC and mcmodel= flags especially
with static libs. I understand that -fpic is needed for shared libs.
We are using ifort 11, 64bit on CentOS, building/linking
against static libs.
Application depends on several libraries and it is not
clear to me when to use the -fpic or mcmodel flags.
(ex: =mcmodel=medium -shared_intel)
How "deep" do you have to go with this?
Originally, we used -mcmodel=medium -shared_intel on all
app and libraries but my understanding is that is only needed
on the main application for link time. If all libs are built with
-fpicthan they can be moved around appropriately in mem.
Our application does use arrays that add up to >2GB.
Some individual arrays may be >2GB. One of the libs
will manipulate these arrays and need access to them.
Application (-mcmodel=medium -shared_intel)
Depends on libs that depend on other libs.
Some libs will access those large arrays.
Example: App (-mcmodel=medium -shared_intel) uses >2GB array space
-> LibA (built with -fPIC ok?) uses >2G arrays
-> HDF (built with -fPIC)
-> szip (-fPIC needed or not?)
-> -lm (system)
Question, does LibA need to be built with mcmodel=medium -shared_intel ?
side note, with ifort 10 we used to use the -mcmodel on App, LibA, HDF but since moving to
ifort 11 we can only avoid the link time relocation errors if we use -fpic on the HDF. Did
the behaviour change?
A pointer to a any clear documentation would be very helpful.