pgi, iccコンパイルオプション

混乱するのでまとめました。

PGI

使い方

openmpで並列化するときはとりあえずはこれでいいはず。 でも、なぜか-mp指定しなくてもOpenMPコンパイルが通る。動作は並列化されない。

$ pgcc -fast -Mipa=fast,inline -mp=allcores sample.c 

オプションを上書きしたいときは後ろに書いていくこと。

option option詳細 その他
-fast -O2 -Munroll=c:1 -Mnoframe -Mlre -Mautoinline == -Mvect=sse -Mcache_align -Mflushz -Mpre
-fastsse -fastと同じ
-O3 -Mvect=sse -Mcache_align -Mpre
-Bstatic Passed to linker; specify static binding 静的にリンクしたバイナリを作成してくれる
-tp cpuに合わせた最適化を行う
-Mipa=inline インライン対象となるサブルーチン、あるいは関数を探し、これらを呼び出す(call)ブロック内に自動インライン化するためのオプション
-Mipa=fast 内部手続き(関数)間の各種グローバルな最適化を 1 パスで行うためのオプション
-mp openmpの並列化を行う align, allcores, 等

helpみるときは

$ pgcc -tp -help

参考サイト

公式ページ

PGI コンパイラの一般的に使用する最適化オプション

PGIコンパイラのコンパイルオプションの説明

その他

Intel Compiler

使い方

だいたい最速なのでは。有償だから使える環境は限られる。

$ icc -std=c++17 -fast -qopenmp  sample.c
option oprion詳細
-fast -ipo, -O3, -no-prec-div, -static, -fp-model fast=2 -xHost
-std ちゃんとversionを指定すべきかも
-parallel 自動並列化 してくれる

いずれ自動並列化のベンチマークをとりたい。

メモ

makeでリンクするときには-fastoptionの-staticがいらない。warningが出る。 warningの一部が以下。

In function `ompt_pre_init':
(.text+0x2280): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

参考サイト

その他

Intelコンパイラ | スパコンマニュアル

一般的なこと

option option詳細
-o FILEMAME オブジェクトファイルの名前の指定
-c 中間ファイルだけ作成