Reputation: 11
Now I'm using icc to compile and run my ANSI C code.
When I turn on -O2 optimize, everything is ok. But when I change to -fast, the results diverge (with lots of nan).
I googled and tried, and found the error exist cause of -xHOST in -fast.
I wanna know how does -xHOST work in compiling. And how to avoid this kind of error in my code?
Upvotes: 1
Views: 1738
Reputation: 12341
-fast turns on many agressive compiler options below is from the intel docs
Description
This option maximizes speed across the entire program. It sets the following options:
• On Itanium®-based systems: Windows: /O3 and /Qipo Linux: -ipo, -O3, and -static
• On IA-32 and Intel® EM64T systems:
Mac OS: -ipo, -O3, -no-prec-div, and -static
Windows: /O3, /Qipo, /Qprec-div-, and /QxP
Linux: -ipo, -O3, -no-prec-div, -static, and -xP
Note that programs compiled with the -xP (Linux) or /QxP (Windows) option will detect non-compatible processors and generate an error message during execution.
On IA-32 and Intel® EM64T systems, the -xP or /QxP option that is set by the fast option cannot be overridden by other command line options. If you specify the fast option and a different processor-specific option, such as -xN (Linux) or /QxN (Windows)
where as -xHost
Generates instruction sets up to the highest that is supported by the compilation host. On Intel processors, this corresponds to the most suitable /Qx (-x) option; on compatible, non-Intel processors, this corresponds to the most suitable of the /arch (-m) options IA32, SSE2 or SSE3. This option may result in additional optimizations for Intel microprocessors that are not
performed for non-Intel microprocessors.‡
so if the problem is with -xHost see if enforcing -march for the proper arch type of your processor fixes the errors or just use -O3
Upvotes: 1