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

-mcmodel=large -shared -intel and "Segmentation Fault"

Mistry__Mital
Beginner
2,441 Views
Dear All,

I used "-mcmodel=large -shared -intel" to enable large array memory allocation and code did compiled. but when I tried to run it it gave me the "Segmentation Fault Error."

I am using gcc compiler.

Before using "-mcmodel=large -shared -intel" I was getting following error,

****************************************
/usr/lib/../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
/tmp/ccStHBkM.o: In function `MAIN__':
FormingSc2_2D_NEW_II.f95:(.text+0x16): undefined reference to `_gfortran_set_options'
FormingSc2_2D_NEW_II.f95:(.text+0x60): undefined reference to `_gfortran_st_open'
FormingSc2_2D_NEW_II.f95:(.text+0xaa): undefined reference to `_gfortran_st_open'
FormingSc2_2D_NEW_II.f95:(.text+0xf4): undefined reference to `_gfortran_st_open'
FormingSc2_2D_NEW_II.f95:(.text+0x13e): undefined reference to `_gfortran_st_open'
FormingSc2_2D_NEW_II.f95:(.text+0x188): undefined reference to `_gfortran_st_open'
FormingSc2_2D_NEW_II.f95:(.text+0x1e3): undefined reference to `_gfortran_st_read'
FormingSc2_2D_NEW_II.f95:(.text+0x217): relocation truncated to fit: R_X86_64_32S against `.bss'
FormingSc2_2D_NEW_II.f95:(.text+0x228): undefined reference to `_gfortran_transfer_real'
FormingSc2_2D_NEW_II.f95:(.text+0x246): undefined reference to `_gfortran_st_read_done'
FormingSc2_2D_NEW_II.f95:(.text+0x311): relocation truncated to fit: R_X86_64_32S against `.bss'
FormingSc2_2D_NEW_II.f95:(.text+0x326): relocation truncated to fit: R_X86_64_32S against `.bss'
FormingSc2_2D_NEW_II.f95:(.text+0x3fd): undefined reference to `_gfortran_st_write'
FormingSc2_2D_NEW_II.f95:(.text+0x442): undefined reference to `_gfortran_transfer_integer'
FormingSc2_2D_NEW_II.f95:(.text+0x460): undefined reference to `_gfortran_st_write_done'
FormingSc2_2D_NEW_II.f95:(.text+0x524): relocation truncated to fit: R_X86_64_32S against `.bss'
FormingSc2_2D_NEW_II.f95:(.text+0x53b): relocation truncated to fit: R_X86_64_32S against `.bss'
FormingSc2_2D_NEW_II.f95:(.text+0x563): relocation truncated to fit: R_X86_64_32S against `.bss'
FormingSc2_2D_NEW_II.f95:(.text+0x57a): relocation truncated to fit: R_X86_64_32S against `.bss'
FormingSc2_2D_NEW_II.f95:(.text+0x5a2): relocation truncated to fit: R_X86_64_32S against `.bss'
FormingSc2_2D_NEW_II.f95:(.text+0x5b9): relocation truncated to fit: R_X86_64_32S against `.bss'
FormingSc2_2D_NEW_II.f95:(.text+0x5e1): relocation truncated to fit: R_X86_64_32S against `.bss'
FormingSc2_2D_NEW_II.f95:(.text+0x5f8): additional relocation overflows omitted from the output
FormingSc2_2D_NEW_II.f95:(.text+0xe43): undefined reference to `_gfortran_st_write'
FormingSc2_2D_NEW_II.f95:(.text+0xe88): undefined reference to `_gfortran_transfer_real'
FormingSc2_2D_NEW_II.f95:(.text+0xea6): undefined reference to `_gfortran_st_write_done'
FormingSc2_2D_NEW_II.f95:(.text+0xef6): undefined reference to `_gfortran_st_close'
FormingSc2_2D_NEW_II.f95:(.text+0xf2b): undefined reference to `_gfortran_st_close'
FormingSc2_2D_NEW_II.f95:(.text+0xf60): undefined reference to `_gfortran_st_close'
FormingSc2_2D_NEW_II.f95:(.text+0xf95): undefined reference to `_gfortran_st_close'
collect2: ld returned 1 exit status

*************************************************************

When I used "gcc -mcmodel=large -shared -intel" There was no error in compilation but when I run ./a.out
It gave me error"Segmentation Fault"

*************************************************************

Below are the arrays I am using in my code.

DOUBLE PRECISION, DIMENSION(62115840,3) :: Sc
DOUBLE PRECISION, DIMENSION(50000000,3) :: Sc2
DOUBLE PRECISION, DIMENSION(50000000,3) :: SpK

Thank you.

Mital.
0 Kudos
5 Replies
Ron_Green
Moderator
2,441 Views
Make sure the 1 option "-shared-intel" is one option. This post makes it look like you used 2 options "-shared" and "-intel". It should be "-shared-intel".

Roughly, your arrays require 3.9GB of storage. So your server has over 4GB of RAM, correct? Maybe 6GB would be sufficient, but greater than 6GB would be better.

Read through this article: http://software.intel.com/en-us/articles/determining-root-cause-of-sigsegv-or-sigbus-errors/

Then if -heap-arrays doesn't help, compile and linke with -g -traceback.

If you are mixing ifort and gcc code, make sure gcc is using -m64. You are NOT also linking gfortran code are you?

ron
0 Kudos
Mistry__Mital
Beginner
2,441 Views
Thank you Ronald,

"-shared-intel" is not working if I use both seperat then it works and yes I am using linking gfortran code. And I am running my code on cluster with 8gb RAM.

Mital
0 Kudos
Ron_Green
Moderator
2,441 Views
-shared-intel works with newer versions of ifort. Older versions used -i-shared option. What version of the compiler are you using?

Also, some versions of 64bit Linux limit static data to 2GB no matter what you do with the compiler. Not all distributions, but some. Windows x64 also limits static data to 2GB. I would suggest considering making that data allocatable rather than static arrays like you showed from your code. There are no limits on data that is allocated, well, your limit is your physical ram + swap space.

ron
0 Kudos
Mistry__Mital
Beginner
2,441 Views
I am using 11.0 verson, and I have to run gfortran instead of ifort. Can I pass the same command for gfortran, I mean "-shared-intel".

Thanks Ronald..
Mital
0 Kudos
Mistry__Mital
Beginner
2,441 Views
Thanks Ronald,

It worked as I compile with ifort.....

Mital....
0 Kudos
Reply