====== 概要 ======
* Intel Parallel Studio XE は2020年に Intel oneAPI に生まれ変わりました。
* Ubuntu 26.04
* OneAPI 2026.0
* 無料で使えます。
====== oneAPIのインストール ======
===== aptを使ってのoneAPIのインストール =====
* /opt/intel/oneapi/にインストールされます。
* [[https://www.intel.com/content/www/us/en/developer/tools/oneapi/oneapi-toolkit-download.html|ダウンロードページ]]の"Select options below to download"で Linux -> APT を選ぶと詳しい方法が出てきます
* そのままコピペすると次のとおりです
$ sudo apt update
$ sudo apt install -y gnupg wget
# download the key to system keyring
$ wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \
| gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
# add signed entry to apt sources and configure the APT client to use Intel repository:
$ echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
$ sudo apt update
$ sudo apt install intel-oneapi-toolkit
$ sudo apt update
$ sudo apt -y install cmake pkg-config build-essential
# Fortan (ifx) を使うならgfortranも
$ sudo apt -y install gfortran
====== パスの設定 ======
インストールしたコンパイラを使えるようにします。
* ホーム・ディレクトリにある .bashrc という名前のファイルを開き(Nautilusから開く場合は隠しファイルはCtrl+hで表示できます)、ファイルの最後に次の文を付け加えます。
$ vi ~/.bashrc
source /opt/intel/oneapi/setvars.sh
* これをすると、毎回ターミナルを開くたびにOneAPIの読み込み画面が表示されます。これを表示させないようにするには、次のようにします
source /opt/intel/oneapi/setvars.sh > /dev/null
* 以下のようにコマンドを入力して .bashrc を読み込みます。
$ source ~/.bashrc
* ちゃんとインストールがされたか、次のように入力します。
$ icx -v
* バージョンが表示されればインストールに成功しています。
====== Intel Compilerについて ======
^言語^Intel compier (2023以前)^Intel compier^GCC^
|C/C++|icc|icx|gcc|
|C++|icpc|icpx|g++|
|Fortran|ifort|ifx|gfortran|
====== Intel MPIについて ======
OpenMPIとIntel MPIのコンパイラ名の対応関係は次のようになっています
^言語^Intel MPI (2023以前)^Intel MPI^OpenMPI^
|C/C++|mpiicc|mpiicx|mpicc|
|C++|mpiicpc|mpiicpx|mpicxx|
|Fortran|mpiifort|mpiifx|mpif90|
コンパイルと実行方法は以下のとおりです。
オプション-nは並列数を指定します。
$ mpiicc program.cc -o program
$ mpirun -n 12 program
* mpirunの代わりにmpiexecとしても同じです
* 歴史的にはもともとMPICHという実装でプログラムの実行にmpirunというスクリプトが使われていましたが、他のMPI実装でも使えるようにmpiexecという統一規格が定められたそうです
* mpirunは、mpiexecに各実装の追加機能を盛り込んだものと思って差し支えありません
====== Get Started ======
* https://software.intel.com/content/www/us/en/develop/documentation/get-started-with-intel-oneapi-base-linux/top/before-you-begin.html