Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28632 Discussions

vsl compilation error for large random number sequences

obrandt
Beginner
552 Views
Dear users,

Strangely, I get a compilation error when trying to statically compile a f77 executable which uses random number series beyond (a suspiciosly small) sequence length of < 2^27:

/tmp/ifortiRHFnl.o: In function `MAIN__':
./gaus.f:(.text+0x3c): relocation truncated to fit: R_X86_64_32 against `.bss'
./gaus.f:(.text+0x84): relocation truncated to fit: R_X86_64_32 against `.bss'
./gaus.f:(.text+0xae): relocation truncated to fit: R_X86_64_32 against `.bss'
./gaus.f:(.text+0xb3): relocation truncated to fit: R_X86_64_32 against `.bss'
./gaus.f:(.text+0xe7): relocation truncated to fit: R_X86_64_32 against `.bss'
./gaus.f:(.text+0xec): relocation truncated to fit: R_X86_64_32 against `.bss'
./gaus.f:(.text+0xf6): relocation truncated to fit: R_X86_64_32 against `.bss'
./gaus.f:(.text+0x381): relocation truncated to fit: R_X86_64_PC32 against `var$1877.0.3'
./gaus.f:(.text+0x3a7): relocation truncated to fit: R_X86_64_32S against `.bss'
./gaus.f:(.text+0x3b1): relocation truncated to fit: R_X86_64_32S against `.bss'
./gaus.f:(.text+0x799): additional relocation overflows omitted from the output

This happens if the length of the sequesnce is set to values larger than about 1.3e7 x 10 dimensions, i.e. > 1.3e8 ~ 2^27, which is smaller than the maximal length advertised in the MKL library for Sobol sequences (2^32). Everything compiles and runs fine for sequence lenths <2^27, but I really need to go all the way to 2^30. Here is the code I use to initilase the RN stream:

c ... ***** Initialize *****
parameter (length=13000000)

c ... initialise RN stream
n=length*ndim
brnga=VSL_BRNG_SOBOL
method=VSL_RNG_METHOD_UNIFORM_STD
errcode=vslnewstream( vslstreamstatea, brnga, ndim ) ! PRN
call CheckVslError(errcode)

This is on a 64bit linux machine (Scientific Linux 5). The compilation line is:

ifort -real-size 64 -O2 -vec-report1 -I${MKLROOT}/include ./gaus.f -Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_intel_lp64.a ${MKLROOT}/lib/intel64/libmkl_sequential.a ${MKLROOT}/lib/intel64/libmkl_cor e.a -Wl,--end-group -L${MKLROOT}/../compiler/lib/intel64 -liomp5 -lm -lpthread -o gaus.x

I'd much appreciate any help on this.

Oleg
0 Kudos
3 Replies
Ron_Green
Moderator
552 Views
Even for 64bit linux and 64bit applications, many OS vendors limit static data to 2 or 4GB. I don't see it here, but do you have a static array declared to hold these values? COMMON block?

If so, make the arrays allocatable. Allocateable arrays would be heap allocated, not in bss (static) like static arrays and COMMONS.

You can also move the Intel libraries to dynamic AND set mcmodel to help:

-dynamic-intel -mcmodel medium

ron
0 Kudos
Ron_Green
Moderator
552 Views
I forgot to mention: the error message is the linker saying it cannot fit your program into a 32bit image. The -mcmodel medium usually takes care of that. 32bit is the default memory model on linux, one has to use -mcmodel to override that.

ron
0 Kudos
obrandt
Beginner
552 Views
Thanks a lot Ron, I tried that out and indeed, it fixes the problem!

All best,

Oleg
0 Kudos
Reply