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

reshape function leading to segmentation fault

johnpaulodonnell
Beginner
1,134 Views

Hi.

Running Suse 10.1 on an x86_64 machine.

I'm getting a segmentation fault when I run a fortran 90 executable. The fortran code itself compiles fine - I'm using the intel fortran compiler: ifort (IFORT) 9.0 20051201.

Using idb I have tracked down the line causing the seg fault:

mat=reshape(bderi,(/npar*npar/))

I cannot figure out why this is happening...

bderi is a big square matrix, with extents (npar, npar). npar is currently 10343. Running the code from within idb I've checked
the sizes of both matrices and they are as they should be - mat a 1-dim array of extent (npar*npar). Also up to this point the
entries of bderi matrix seem fine...but when I check mat matrix the entries are mostly zero - which they shouldn't be...

and then I get a segmetation fault when the line above is executed.

Would be grateful if anyone might be able to point me in the right directrion here - I don't have a lot of programming experience!

thanks. 

0 Kudos
8 Replies
Steven_L_Intel1
Employee
1,134 Views

My guess is that the compiler is creating a temporary value for the result of the reshape on the stack and you've exceeded your stacksize limit. You can try raising the stacksize limit. If you were using a current 9.1 compiler, you could also use the -heap-arrays switch that causes these array temps to be allocated on the heap.

I suppose it's possible there's a compiler bug, but the stack issue seems more probable. I would suggest updating the compiler if you can. The version you have is more than a year old and is unsupported.

0 Kudos
johnpaulodonnell
Beginner
1,134 Views
many thanks Steve - that's worked!

Although a little further along the line I am now running into a new error:

forrtl: severe (41): insufficient virtual memory

this I don't understand as the virtual memory is set to unlimited...

Does anyone have any ideas as to how to resolve this error?

thanks.
0 Kudos
Steven_L_Intel1
Employee
1,134 Views
"unlimited" doesn't really mean that - it means "as much as the kernel is configured to allow, subject to other limits based on available pagefile and RAM. Do make sure that you are using the 64-bit compiler ("for Intel EM64T") and not the 32-bit compiler.
0 Kudos
TimP
Honored Contributor III
1,134 Views
You said you are running on an x86_64 machine, but give the impression youmay beusing the 32-bit ifort. In that case, your address space is definitely limited. If you are using idb, rather than idbe, that would indicate you selected the 32-bit operating system installation, which would limit you to the 32-bit ifort.
0 Kudos
johnpaulodonnell
Beginner
1,134 Views
ok. thanks Steve and Tim. WIll need to check this out. A silly mistake if that is the problem!
0 Kudos
johnpaulodonnell
Beginner
1,134 Views
yeah. Was using the 32-bit debugger...doh!

Have I been using a 32-bit compiler!? How can I tell?

ifort (IFORT) 9.0 20051201


this is the compiler I've been using to compile code on a 64-bit machine...just by invoking ifort
0 Kudos
Steven_L_Intel1
Employee
1,134 Views

The banner that displays when "ifort" is invoked should say 32-bit or "EM64T" for 64-bit. The path to the 64-bit ifort will contain /fce/ - the 32-bit compiler is /fc/. Check the "source" command you use to make ifort available. Also, the 64-bit debugger is /idbe/.

Please note that 9.0 is not a supported version of the compiler. 9.1 is current.

0 Kudos
johnpaulodonnell
Beginner
1,134 Views
thanks for that Steve.
0 Kudos
Reply