Неправильные результаты с флагом icc -fast

Теперь я использую icc для компиляции и запуска моего кода ANSI C.

Когда включаю оптимизацию -O2, все ок. Но когда я перехожу на -fast, результаты расходятся (с большим количеством нан).

Я погуглил и попробовал, и нашел причину существующей ошибки -xHOST в -fast.

Я хочу знать, как -xHOST работает при компиляции. И как избежать такого рода ошибок в моем коде?

1 ответ

-быстрое включение многих агрессивных опций компилятора ниже от 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)

где как -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.‡

поэтому, если проблема связана с -xHost, посмотрите, исправляет ли ошибка -march для правильного типа арки вашего процессора, или просто используйте -O3

Другие вопросы по тегам