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

Problems to compile fortran and C++ programs

bulcao
Beginner
879 Views
I'm using fortran and C++ to write my programs. I'm using C++ to allocate memory and fortran to do the work.
I compile my program without any error massages, but when I try to run the program stop whit this messages:

** Illegal Instruction **
End of diagnostics

Do you have any suggestion of what I need to look for to find the error?

The break point depends of level of optimization
0 Kudos
5 Replies
Steven_L_Intel1
Employee
879 Views
What switches are you using for the compilation and what kind of processor are you running on? The most common cause of an "illegal instruction" error is using one of the architecture-specific code generation options (-QxW, for example), but running on a processor that doesn't support that instruction set.

Steve
0 Kudos
bulcao
Beginner
879 Views
Steve,
Thanks a lot for your answer.
I'm running on a Pentium III CPU family 1133MHz with cache size : 512 KB, under Red Hat Linux 7.1.
In my makefile I use this options:
-tpp6 -xKW -ip -w -I/usr/include -Vaxlib -lm
with the option -O3 or -O0

Do you think that there are some problems with this options?

Regards
bulcao
0 Kudos
Steven_L_Intel1
Employee
879 Views
Replace -xKW with -xK and see what happens. I'm still a bit fuzzy on how -x with multiple target codes works. I think -axKW would work and do auto-dispatch.

Steve
0 Kudos
bulcao
Beginner
879 Views
It works!
The problem was that I used the option -xKW, when I follow your suggestion, i.e., replace -xKW with -xK or -axKW the program run correctly.
Thanks

I still have a gap when I compare the performance betwen GNU and Intel compiler

GNU compiler: real time 0m39.583s
Compile options: -fno-globals -Wno-globals -O3

Intel compiler: real time 0m47.497s
Compile options: -tpp6 -axKW -ip -w -Vaxlib -O3

At least works!
Now I can try optimize the source code for Intel compiler.

Thanks
0 Kudos
Steven_L_Intel1
Employee
879 Views
-xK will give you somewhat better performance than -axKW.

Explanation: -xKW basically told the compiler to assume Pentium 4 instructions (the K was ignored). -xK says assume Pentium III.

-axKW says to generate code that automatically detects the CPU type and dispatches to one of three different code sets, generic, Pentium III and Pentium 4. This may slow down a program somewhat.

Steve
0 Kudos
Reply