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

Illegal instruction

John_Hickey
Beginner
1,627 Views
Hi,
I have a fortran program which I have been compiling for years without problems on g95, gfortran and lahey. Now I try on intel and i get the error message "Illegal instruction"
I compile with:
ifort AlphaPhase.f90 -fast -O3 -m64 -o AlphaPhase1.1
I have narrowed down the problem to where I do a matrix multiplication:
MarkerNRM=matmul(GenosR,transpose(GenosR))
Is it a stackpace issue?
Can you advise?
Regards,
John Hickey.
0 Kudos
6 Replies
mecej4
Honored Contributor III
1,627 Views
> Is it a stackpace issue?
Possibly; however, there are many other possible causes of the problem.
> Can you advise?
We need to see the code (preferably, a small and complete example that can be compiled and run) first. Which OS are you on, and which version of the compiler did you use? Does the error occur only with the compiler options that you displayed?
0 Kudos
Udit_P_Intel
Employee
1,627 Views
You may want to try removing flags one at a time, especially the O3 and fast flags. Since very aggressive optimisations are performed for MATMUL(), try executing with O0 and then you'll know whether an optimisation is going wrong or if there is some other problem. As mentioned above, it would be very helpful to provide a small reproducing program.
Best!
-Udit
0 Kudos
Steven_L_Intel1
Employee
1,627 Views
Are you running the program on the same system where you compile it? -fast implies -arch host, which means use the instruction set for the CPU you compiled on. Don't use this if you are running the program somewhere else. You can add a -x option that is correct for the compiling and target systems.
0 Kudos
Ron_Green
Moderator
1,627 Views
John,

I assume you are on Mac for 2 reasons: 1, illegal instruction on Mac OS is the same as sigsegv on Linux. 2, you use -m64 which is a Mac compiler option.

Yes, this is probably a stack problem: http://software.intel.com/en-us/articles/determining-root-cause-of-sigsegv-or-sigbus-errors/

Macs are a bit more difficult, as ulimit -s on Mac OS will only unlimit up to the 64MB: ulimit -s 65532. After that, you'll need the to use the linker via the -Wl option above to increase it further.

You may try to split out the matmul into 2 statement:

transR = transpose(GenosR)
MarkerNRM = matmul( GenosR,transR )

The use of transpose(GenosR) inside another function call is sure to create an array temporary the size of GenosR on stack. The way I've coded it above in 2 steps avoids the stack, at the expense of a temporary array transR that will be heap allocated. It's worth a try.

ron
0 Kudos
tkibedi
Novice
1,627 Views

Recently we are experiencing a similar problem with our Fortran 90 codes. Using the same MakeFile and source code two executables were created, one with ifort 12.1.2 and the other with ifort 13.01. The firs executable seemingly works OK on a number of computers, the second one fails with the "illegal instruction" error. What compiler switches should be used to get around this problem using the more recent compiler?

0 Kudos
Steven_L_Intel1
Employee
1,627 Views

What command line are you using to compile and which specific model of CPU does the problem computer have? My guess is that you are using a -m option specifying an instruction set not supported on the problem computer.

0 Kudos
Reply