[ English | Japanese ]
コンパイルとリンク (Fortran用)
このページでは、Vector Engine 向けのNEC Numeric Library Collectionを使ったユーザプログラムのコンパイル方法およびライブラリとのリンク方法を説明します。
必要となるコンパイラオプションは次の条件により変わってきます。
- 使用するライブラリ
- 分散メモリ並列の有無
- 共有メモリ並列の有無
- デフォルト整数型のサイズ
事前準備
コンパイルとリンクを行う前に、コンパイル環境設定スクリプトnlcvars.sh または nlcvars.cshを一度実行する必要があります。
sh系:
$ source /opt/nec/ve/bin/nlcvars.sh [引数...]
csh系:
% source /opt/nec/ve/bin/nlcvars.csh [引数...]
指定するべき引数は表1の通りです。
| 分散メモリ並列 | デフォルト整数型 | 引数 |
|---|---|---|
| なし | 32bit | なし |
| なし | 64bit | i64 |
| MPI | 32bit | mpi |
| MPI | 64bit | mpi i64 |
| 注意事項 |
|---|
|
NEC Numeric Library Collectionのバージョンを指定する場合
NEC Numeric Library Collection 3.0.0以降は、VE30用と
VE20およびVE10/VE10E用のライブラリおよびインクルードファイル等を提供しています。
-
VE30用
/opt/nec/ve3/nlc/X.X.X/{include/, lib/, bin/} -
VE20用およびVE10/VE10E用
/opt/nec/ve/nlc/X.X.X/{include/, lib/, bin/}
NEC Numeric Library Collectionのバージョンを指定する場合は、
コンパイルとリンクを行う前に、以下の方法でバージョンを指定してください。
-
VE30用
sh系:
$ source /opt/nec/ve3/nlc/X.X.X/bin/nlcvars.sh [引数...]
csh系:
% source /opt/nec/ve3/nlc/X.X.X/bin/nlcvars.csh [引数...]
ここで、X.X.X は NEC Numeric Library Collection のバージョン番号を表します。引数は表1を参照してください。
-
VE20用およびVE10/VE10E用
sh系:
$ source /opt/nec/ve/nlc/X.X.X/bin/nlcvars.sh [引数...]
csh系:
% source /opt/nec/ve/nlc/X.X.X/bin/nlcvars.csh [引数...]
ここで、X.X.X は NEC Numeric Library Collection のバージョン番号を表します。引数は表1を参照してください。
コンパイル方法
コンパイルに用いるコマンドは、逐次またはOpenMP並列のライブラリを利用する場合nfort、 MPI並列またはハイブリッド並列のライブラリを利用する場合mpinfortです。 32bit整数版ライブラリを利用する場合は、表2のコンパイルオプションを指定してコンパイルします。 64bit整数版ライブラリを利用する場合は、表3のオプションを指定してコンパイルします。
| ライブラリ名 | コンパイルオプション | |
|---|---|---|
|
ASL ネイティブインタフェース |
逐次 | なし |
| OpenMP並列 | -fopenmp | |
| ASL統合インタフェース | 逐次 | なし |
| OpenMP並列 | -fopenmp | |
| MPI並列 | なし | |
| ハイブリッド並列 | -fopenmp | |
| FFTW3インタフェース | 逐次 | なし |
| OpenMP並列 | -fopenmp | |
| MPI並列 | なし | |
| ハイブリッド並列 | -fopenmp | |
| BLAS | 逐次 | なし |
| OpenMP並列 | -fopenmp | |
| LAPACK | 逐次 | なし |
| OpenMP並列 | -fopenmp | |
| ScaLAPACK BLACS |
MPI並列 | なし |
| ハイブリッド並列 | -fopenmp | |
| SBLAS | 逐次 | なし |
| OpenMP並列 | -fopenmp | |
| HeteroSolver | OpenMP並列 | -fopenmp |
| ハイブリッド並列 | ||
| Stencil Code Accelerator | 逐次 | なし |
| OpenMP並列 | -fopenmp | |
| ライブラリ名 | コンパイルオプション | |
|---|---|---|
|
ASL ネイティブインタフェース |
逐次 | -fdefault-integer=8 |
| OpenMP並列 | -fdefault-integer=8 -fopenmp | |
| ASL統合インタフェース | 逐次 | -fdefault-integer=8 |
| OpenMP並列 | -fdefault-integer=8 -fopenmp | |
| MPI並列 | -fdefault-integer=8 -fdefault-real=8 | |
| ハイブリッド並列 | -fdefault-integer=8 -fdefault-real=8 -fopenmp | |
| FFTW3インタフェース | 逐次 | -fdefault-integer=8 |
| OpenMP並列 | -fdefault-integer=8 -fopenmp | |
| MPI並列 | -fdefault-integer=8 -fdefault-real=8 | |
| ハイブリッド並列 | -fdefault-integer=8 -fdefault-real=8 -fopenmp | |
| BLAS | 逐次 | -fdefault-integer=8 |
| OpenMP並列 | -fdefault-integer=8 -fopenmp | |
| LAPACK | 逐次 | -fdefault-integer=8 |
| OpenMP並列 | -fdefault-integer=8 -fopenmp | |
| ScaLAPACK BLACS |
MPI並列 | -fdefault-integer=8 -fdefault-real=8 |
| ハイブリッド並列 | -fdefault-integer=8 -fdefault-real=8 -fopenmp | |
| SBLAS | 逐次 | -fdefault-integer=8 |
| OpenMP並列 | -fdefault-integer=8 -fopenmp | |
| HeteroSolver | OpenMP並列 | -fdefault-integer=8 -fopenmp |
| ハイブリッド並列 | -fdefault-integer=8 -fdefault-real=8 -fopenmp | |
| Stencil Code Accelerator | 逐次 | -fdefault-integer=8 |
| OpenMP並列 | -fdefault-integer=8 -fopenmp | |
リンク方法
リンクに用いるコマンドは、逐次またはOpenMP並列のライブラリを利用する場合nfort、 MPI並列またはハイブリッド並列のライブラリを利用する場合mpinfortです。 32bit整数版ライブラリを利用する場合は、表4のリンクオプションを指定してリンクします。 64bit整数版ライブラリを利用する場合は、表5のリンクオプションを指定してリンクします。 静的リンクで実行ファイルを作成する場合は、追加で-staticオプションを指定してください。 動的リンクで実行ファイルを作成する場合は、追加でオプションを指定する必要はありませんが、 MPI を使用する場合は、 -shared-mpi オプションを指定しなければなりません。
| ライブラリ名 | リンクオプション | |
|---|---|---|
|
ASL ネイティブインタフェース |
逐次 | -lasl_sequential |
| OpenMP並列 | -lasl_openmp -fopenmp | |
| ASL統合インタフェース | 逐次 | -lasl_sequential |
| OpenMP並列 | -lasl_openmp -fopenmp | |
| MPI並列 | -lasl_mpi_sequential | |
| ハイブリッド並列 | -lasl_mpi_openmp -fopenmp | |
| FFTW3インタフェース | 逐次 | -laslfftw3 -lasl_sequential |
| OpenMP並列 | -laslfftw3 -lasl_openmp -fopenmp | |
| MPI並列 | -laslfftw3_mpi -lasl_mpi_sequential | |
| ハイブリッド並列 | -laslfftw3_mpi -lasl_mpi_openmp -fopenmp | |
| BLAS | 逐次 | -lblas_sequential |
| OpenMP並列 | -lblas_openmp -fopenmp | |
| LAPACK | 逐次 | -llapack -lblas_sequential |
| OpenMP並列 | -llapack -lblas_openmp -fopenmp | |
| ScaLAPACK BLACS |
MPI並列 | -lscalapack -llapack -lblas_sequential |
| ハイブリッド並列 | -lscalapack -llapack -lblas_openmp -fopenmp | |
| SBLAS | 逐次 | -lsblas_sequential |
| OpenMP並列 | -lsblas_openmp -fopenmp | |
| HeteroSolver | OpenMP並列 | -lheterosolver_openmp -lblas_sequential -fopenmp |
| ハイブリッド並列 | -lheterosolver_mpi_openmp -lblas_sequential -fopenmp |
|
| Stencil Code Accelerator | 逐次 | -lsca_sequential |
| OpenMP並列 | -lsca_openmp -fopenmp | |
| ライブラリ名 | リンクオプション | |
|---|---|---|
|
ASL ネイティブインタフェース |
逐次 | -lasl_sequential_i64 |
| OpenMP並列 | -lasl_openmp_i64 -fopenmp | |
| ASL統合インタフェース | 逐次 | -lasl_sequential_i64 |
| OpenMP並列 | -lasl_openmp_i64 -fopenmp | |
| MPI並列 | -fdefault-integer=8 -fdefault-real=8 -lasl_mpi_sequential_i64f | |
| ハイブリッド並列 | -fdefault-integer=8 -fdefault-real=8 -lasl_mpi_openmp_i64f -fopenmp | |
| FFTW3インタフェース | 逐次 | -laslfftw3_i64 -lasl_sequential_i64 |
| OpenMP並列 | -laslfftw3_i64 -lasl_openmp_i64 -fopenmp | |
| MPI並列 | -fdefault-integer=8 -fdefault-real=8 -laslfftw3_mpi_i64f -lasl_mpi_sequential_i64f | |
| ハイブリッド並列 | -fdefault-integer=8 -fdefault-real=8 -laslfftw3_mpi_i64f -lasl_mpi_openmp_i64f -fopenmp | |
| BLAS | 逐次 | -lblas_sequential_i64 |
| OpenMP並列 | -lblas_openmp_i64 -fopenmp | |
| LAPACK | 逐次 | -llapack_i64 -lblas_sequential_i64 |
| OpenMP並列 | -llapack_i64 -lblas_openmp_i64 -fopenmp | |
| ScaLAPACK BLACS |
MPI並列 | -fdefault-integer=8 -fdefault-real=8 -lscalapack_i64f -llapack_i64 -lblas_sequential_i64 |
| ハイブリッド並列 | -fdefault-integer=8 -fdefault-real=8 -lscalapack_i64f -llapack_i64 -lblas_openmp_i64 -fopenmp |
|
| SBLAS | 逐次 | -lsblas_sequential_i64 -fdefault-integer=8 |
| OpenMP並列 | -lsblas_openmp_i64 -fopenmp -fdefault-integer=8 | |
| HeteroSolver | OpenMP並列 | -lheterosolver_openmp_i64 -lblas_sequential_i64 -fopenmp |
| ハイブリッド並列 | -fdefault-integer=8 -fdefault-real=8 -lheterosolver_mpi_openmp_i64f -lblas_sequential_i64 -fopenmp |
|
| Stencil Code Accelerator | 逐次 | -lsca_sequential_i64 |
| OpenMP並列 | -lsca_openmp_i64 -fopenmp | |