Search my blog
Custom Search
Showing posts with label fortran. Show all posts
Showing posts with label fortran. Show all posts

Saturday, September 27, 2008

Intel Fortran relocation truncated to fit error: R_X86_64_32S against `baddr.0'

1.Box and compiler
[*@hello src]$ uname -a
Linux nox 2.6.18-92.1.6.el5.centos.plus #1 SMP Thu Jun 26 12:18:07 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux
[*@hello src]$ cat /proc/cpuinfo
processor : 0
vendor_id : AuthenticAMD
cpu family : 16
model : 2
model name : Quad-Core AMD Opteron(tm) Processor 2354
stepping : 3
cpu MHz : 2210.898
cache size : 512 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 4
fpu : yes
fpu_exception : yes
cpuid level : 5
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc pni cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy altmovcr8 abm sse4a misalignsse 3dnowprefetch osvw
bogomips : 4424.74
TLB size : 1024 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 48 bits physical, 48 bits virtual
power management: ts ttp tm stc 100mhzsteps hwpstate [8]

...(omission)

[*@hello src]$ ifort -V
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 10.1 Build 20080312 Package ID: l_fc_p_10.1.015
Copyright (C) 1985-2008 Intel Corporation. All rights reserved.
FOR NON-COMMERCIAL USE ONLY

2. Error message
[*@hello src]$ make
ifort -O2 -o Bcon_hr_cb4_cntl.exe bcon2ioapi.o read_mconc_nc.o vinterp.o vinterp_top.o hinterp.o makebdy.o get_hv_intp_top.o chemspec.o -L/opt/intel/fce/10.1.015/lib -lguide -lpthread -L/home/lin/local/ioapi-3.0/Linux2_x86_64ifort -lioapi -L/usr/local/netcdf-intel/lib -lnetcdf
/home/lin/local/ioapi-3.0/Linux2_x86_64ifort/libioapi.a(bufint3.o): In function `bufintxd_':
/home/lin/local/ioapi-3.0/ioapi/bufint3.c:(.text+0x22): relocation truncated to fit: R_X86_64_32S against `baddr.0'
/home/lin/local/ioapi-3.0/Linux2_x86_64ifort/libioapi.a(bufint3.o): In function `bufintx_':
/home/lin/local/ioapi-3.0/ioapi/bufint3.c:(.text+0x42a): relocation truncated to fit: R_X86_64_32S against `baddr.0'
/home/lin/local/ioapi-3.0/Linux2_x86_64ifort/libioapi.a(bufint3.o): In function `bufdel3_':
/home/lin/local/ioapi-3.0/ioapi/bufint3.c:(.text+0x829): relocation truncated to fit: R_X86_64_32S against `baddr.0'
/home/lin/local/ioapi-3.0/ioapi/bufint3.c:(.text+0x83d): relocation truncated to fit: R_X86_64_32S against `baddr.0'
/home/lin/local/ioapi-3.0/Linux2_x86_64ifort/libioapi.a(bufint3.o): In function `bufddt3d_':
/home/lin/local/ioapi-3.0/ioapi/bufint3.c:(.text+0x86d): relocation truncated to fit: R_X86_64_32S against `baddr.0'
/home/lin/local/ioapi-3.0/Linux2_x86_64ifort/libioapi.a(bufint3.o): In function `bufddt3_':
/home/lin/local/ioapi-3.0/ioapi/bufint3.c:(.text+0xafe): relocation truncated to fit: R_X86_64_32S against `baddr.0'
/home/lin/local/ioapi-3.0/Linux2_x86_64ifort/libioapi.a(bufint3.o): In function `bufxtr3d_':
/home/lin/local/ioapi-3.0/ioapi/bufint3.c:(.text+0xcd5): relocation truncated to fit: R_X86_64_32S against `baddr.0'
/home/lin/local/ioapi-3.0/Linux2_x86_64ifort/libioapi.a(bufint3.o): In function `bufxtr3i_':
/home/lin/local/ioapi-3.0/ioapi/bufint3.c:(.text+0xeb1): relocation truncated to fit: R_X86_64_32S against `baddr.0'
/home/lin/local/ioapi-3.0/Linux2_x86_64ifort/libioapi.a(bufint3.o): In function `bufxtr3_':
/home/lin/local/ioapi-3.0/ioapi/bufint3.c:(.text+0x108d): relocation truncated to fit: R_X86_64_32S against `baddr.0'
/home/lin/local/ioapi-3.0/Linux2_x86_64ifort/libioapi.a(bufint3.o): In function `bufget3d_':
/home/lin/local/ioapi-3.0/ioapi/bufint3.c:(.text+0x1259): relocation truncated to fit: R_X86_64_32S against `baddr.0'
/home/lin/local/ioapi-3.0/Linux2_x86_64ifort/libioapi.a(bufint3.o): In function `bufget3i_':
/home/lin/local/ioapi-3.0/ioapi/bufint3.c:(.text+0x142b): additional relocation overflows omitted from the output
make: *** [Bcon_hr_cb4_cntl.exe] Error 1

3.Solution
Applications containing more than 2 GB of static data should be built with
"-mcmodel medium -shared-intel" options.
In my application an huge array as following to hold all data needs is used.
---------------------------------------------------------------------------
INTEGER, PARAMETER :: MAXNI = 360, #longtitude
& MAXNJ = 180, #latitude
& MAXNP = 50, #height
& MAXNT = 24, #hours
& MAXNV = 10, #variables

REAL :: meadia(MAXNI,MAXNJ,MAXNP,MAXNT, MAXNV) ! org conc
----------------------------------------------------------------------------
The static array will be:
360×180×50×24×10×4(4bytes/real data type) = 3110,400,000bytes about 3.1G
After specified "-mcmodel medium -shared-intel" the compiler options, the error disappeared.

NOTE:
1)It seems that this error only occurs on AMD 64 CPU architecture. I successed compiling the same application on IA 64 CPU without getting an error.

2)The same error occurred even if specified the "-mcmodel medium -shared-intel" options. Check your sizes of all your static arrays again to make sure they are not too huge.
Theoretically you can not use a static array more than 4G in AMD/IA 32 CPU,
16G in AMD/IA 64 CPU.

4.Reference
http://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/topic/54173

-