導入についての個人的なまとめ Debian/GNU Linux の標準的なパッケージだけで簡単に並列処理で動作するので、Intel のコンパイラなど、Debian 非標準のコンパイラでライブラリを作り直す気が失せてしまった。また、MPI よりも SMP の方が少しだけ速いし、 実行のしかたもちょっとだけ簡単で、1,2次元の計算にも対応している。MPI が推奨されていたりするけれど、特に 問題が発生しなければ gfortran で SMP (smpar) を使うことになると思う。
使ったWRFのバージョン:Ver. 3.4.1, 3.5 必要に応じてバージョンによる違いについてコメントしてある。
用途 | パッケージ名 | バージョン | 説明 |
全般 | |||
gfortran | 4:4.4.5-1 | The GNU Fortran 95 compiler | |
gcc | 4:4.4.5-1 | The GNU C compiler | |
libnetcdf-dev | 1:4.1.1-5 | Development kit for NetCDF | |
libnetcdf6 | 1:4.1.1-5 | An interface for scientific data access to large binary data | |
csh | 20070713-2 | Shell with C-like syntax, standard login shell on BSD systems | |
dmpar (MPIを使う場合。Distributed Memory Parallel) | |||
libopenmpi-dev | 1.4.2-4 | high performance message passing library -- header files | |
libopenmpi1.3 | 1.4.2-4 | high performance message passing library -- shared library | |
openmpi-bin | 1.4.2-4 | high performance message passing library -- binaries | |
openmpi-checkpoint | 1.4.2-4 | high performance message passing library -- checkpoint support | |
openmpi-common | 1.4.2-4 | high performance message passing library -- common files | |
smpar (SMPを使う場合。Shared Memory Parallel) | |||
libgomp1 | 4.4.5-8 | GCC OpenMP (GOMP) support library |
************************** W A R N I N G ************************************ There are some Fortran 20003 features in WRF that your compiler does not recognize The IEEE signaling call has been removed. That may not be enough. *****************************************************************************gfortran が Fortran 2003 に全て対応していないので、うまくいかないかもしれないよ!というメッセージである。
※ 計測した時間は Ver. 3.4.1 で計測したもの。
-> [localhost] ~/WRFV3 15:34:15 $ ./configure checking for perl5... no checking for perl... found /usr/bin/perl (perl) ** WARNING: No path to NETCDF and environment variable NETCDF not set. ** would you like me to try to fix? [y] -> y Enter full path to NetCDF include directory on your system -> /usr/include Enter full path to NetCDF library directory on your system -> /usr/lib ...(中略) ------------------------------------------------------------------------ Please select from among the following supported platforms. 1. Linux x86_64, PGI compiler with gcc (serial) ...(中略) 23. x86_64 Linux, gfortran compiler with gcc (serial) ...(中略) -> Enter selection [1-34] : 23 ------------------------------------------------------------------------ -> Compile for nesting? (0=no nesting, 1=basic, 2=preset moves, 3=vortex following) [default 0]: 0 Configuration successful. To build the model type compile . ...(以下省略)(更新 : 2013-03-25 (月) 15:48:29)
-> ./compileすると、こんな理想化条件が実行できます、というメッセージが出てくるので、2次元の海陸風モデルを選んで実行する。
-> ./compile em_seabreeze2d_x結構な時間をかけてコンパイルすることになる。一番最後に、コンパイルの所要時間が表示された。
build started: 2013年 3月 25日 月曜日 15:46:02 JST build completed: 2013年 3月 25日 月曜日 15:57:42 JST
次元 | ケースの名称 | 設定 |
1 | em_scm_xy | single column model, 4 km, full physics |
2 | em_grav2d_x | gravity current, 100 m |
2 | em_hill2d_x | flow over a hill, 2 km |
2 | em_seabreeze2d_x | water and land, 2 km, 20km top, full physics |
2 | em_squall2d_x | squall line, 250 m |
2 | em_squall2d_y | transpose of above problemINITIALIZATION |
3 | em_b_wave | baroclinic wave, 100 km |
3 | em_fire | surface fire, 50 m |
3 | em_heldsuarez | global case with polar filtering, 625 km |
3 | em_les | large eddy simulation, 100 m |
3 | em_quarter_ss | super cell, 2 km |
3 | em_tropical_cyclone | hurricane, 15 km |
-> cd test/em_seabreeze2d_x -> csh ./run_me_first.csh -> ./ideal.exe -> time ./wrf.exe最後に
d01 2007-06-01_17:00:00 wrf: SUCCESS COMPLETE WRFと表示されて実行も終了。time で測った所要時間は次のとおり。
real 4m59.360s user 4m50.266s(更新 : 2013-03-25 (月) 16:15:02)
※ 計測した時間は Ver. 3.4.1 で計測したもの。
-> [localhost] ~/WRFV3 15:34:15 $ ./configure ...(中略) ------------------------------------------------------------------------ Please select from among the following supported platforms. 1. Linux x86_64, PGI compiler with gcc (serial) ...(中略) 25. x86_64 Linux, gfortran compiler with gcc (dmpar) ...(中略) -> Enter selection [1-34] : 25 ------------------------------------------------------------------------ ...(以下省略)
-> ./compile em_b_wave結構な時間をかけてコンパイルすることになる。一番最後に、コンパイルの所要時間が表示された。
build started: 2013年 3月 25日 月曜日 17:19:28 JST build completed: 2013年 3月 25日 月曜日 17:31:53 JST
-> cd test/em_b_wave -> csh ./run_me_first.csh -> mpirun -n 5 ./ideal.exe -> time mpirun -n 5 ./wrf.exeログは表示されない。mpirun を使って実行するところがミソ。この場合、5個のコアを使っている。time で測った所要時間は次のとおり。
real 3m21.428s user 16m32.850s sys 0m2.952s同じプログラムを serial で実行すると、dmpar では2〜3倍の速さで動いていることがわかる。
real 9m19.641s user 9m2.306s sys 0m14.033s(更新 : 2013-03-25 (月) 18:37:30)
※ 計測した時間は Ver. 3.4.1 で計測したもの。
-> [localhost] ~/WRFV3 15:34:15 $ ./configure ...(中略) ------------------------------------------------------------------------ Please select from among the following supported platforms. 1. Linux x86_64, PGI compiler with gcc (serial) ...(中略) 24. x86_64 Linux, gfortran compiler with gcc (smpar) ...(中略) -> Enter selection [1-34] : 24 ------------------------------------------------------------------------ ...(以下省略)
-> ./compile em_b_wave ...(中略) build started: 2013年 3月 28日 木曜日 12:17:18 JST build completed: 2013年 3月 28日 木曜日 12:28:56 JST
-> cd test/em_b_wave -> csh ./run_me_first.csh -> export OMP_NUM_THREADS=5 -> ./ideal.exe -> time ./wrf.exe ...(中略) real 3m13.938s user 15m12.773s sys 0m28.894s
※ 計測した時間は Ver. 3.4.1 で計測したもの。
-> export J="-j 5"などとすると、コンパイルを並行して実行してくれる。ただし、あまり効果を期待してはいけないようだ。
real 3m27.437s user 16m48.059s sys 0m18.617s劇的ではないが、serial の時より、若干速い。
real 3m13.938s user 15m12.773s sys 0m28.894s
real 3m11.984s user 15m1.412s sys 0m29.902sちょっと速くなる。
real 3m10.386s user 14m55.420s sys 0m29.230s非常に微妙なパフォーマンスの改善である。
real 3m12.716s user 15m4.077s sys 0m29.610s遅くなる意味がわからない。
real 3m10.787s user 14m57.172s sys 0m29.610sこれで十分なようだ。