LoginSignup
0
1

More than 5 years have passed since last update.

[廃版] WRF / WPS > v3.9セットアップ > 失敗: GFortran v4.4.7のバグにはまる

Last updated at Posted at 2017-06-02

以下の情報はセットアップが成功しなかったため廃版とします。 失敗自体が参考になる場合もあるため記事として残しています。


動作環境
Xeon E5-2620 v4 (8コア) x 2
32GB RAM
CentOS 6.8 (64bit)
openmpi-1.8.x86_64 とその-devel
mpich.x86_64 3.1-5.el6とその-devel
gcc version 4.4.7 (とgfortran)
NCAR Command Language Version 6.3.0
WRF v3.7.1を使用。
Python 2.6.6 (r266:84292, Aug 18 2016, 15:13:37) 
Python 3.6.0 on virtualenv

WRF(Weather Research and Forecasting Model)とその前処理であるWPS。

http://qiita.com/7of9/items/8ff328ed1c144d659335
においてWRF3.7.1 / WPS3.7.1をセットアップした環境に、v3.9をインストールする。

WRF3.9 > 成功

手順はWRF3.7.1のビルド > 成功とほぼ同じであるが、configure.wrfファイルの変更が少しだけ違う。

$ diff configure.wrf.orginal configure.wrf
123c123
< DM_CC           =       mpicc -cc=$(SCC) -DMPI2_SUPPORT
---
> DM_CC           =       mpicc -DMPI2_SUPPORT
217c217
<                       -L$(WRF_SRC_ROOT_DIR)/external/io_netcdf -lwrfio_nf -L/usr/lib       
---
>                       -L$(WRF_SRC_ROOT_DIR)/external/io_netcdf -lwrfio_nf -L/usr/lib -lnetcdf -lnetcdff     

v3.7.1にはあった-lnetcdfがv3.9のもともとのconfigure.wrfではなくなっている。
今回は-lnetcdfも追加してexeファイルをcompileした。

WPS3.9 > 要検討

試したこと

WPS3.7.1 > 成功を参考にcompileを行った。

こちらは特にv3.7.1との違いはなかった。

metgrid.exeとungrib.exeがビルドされていなかった。

scan_input.modなどが生成されておらず、原因を追うとscan_input.f90のuse netcdfの部分でエラーが出ていた。

http://qiita.com/7of9/items/b61c88f5debde19227ac
を参考にconfigure.wpsの以下FFLAGSの部分を以下のようにした (NETCDFMODのインクルード追加)。

NETCDFMOD           = /usr/lib64/gfortran/modules/
FFLAGS              = -I${NETCDFMOD} -ffree-form -O -fconvert=big-endian -frecord-marker=4
./compile metgrid

にてmetgrid.exeがビルドされることを確認した。

ungrib.exeがビルドできない問題がある。

分かったこと

関連: WRF / gfortran > Error: NAMELIST attribute conflicts with ALLOCATABLE attribute > gfortranのバージョンv4.4.7で発生

GFortran v4.4.7-17
- geogrid.exe: ビルド可能
- ungrib.exe: ビルド不可 (NAMELIST関連のエラー)
- metgrid.exe: ビルド可能

GFortran v4.9.2
- geogrid.exe: ビルド可能
- ungrid.exe: ビルド可能
- metgrid.exe: ビルド不可 (netcdf.modがv4.4.7-17で生成されていることによる)

異なるバージョンのGFortranで生成したexeを順次実行させた場合に「はまる」だろうか。
(出力ファイルのバイナリ互換性について未消化)。

.modファイルに関しては互換性の問題でビルド時に失敗するようだ。
(v4.4.7-17で生成した.modファイルをuseするf90ファイルを、v4.9.2でビルドしようとすると失敗する)。

.exeファイル実行については未消化。

案 > ソース改変 > 失敗

ungribに関してread_namelist.Fの改変をするとv4.4.7-17でもビルドはできるようになる。

$ diff read_namelist.F.old read_namelist.F
56c56,57
<   real, dimension(:), allocatable :: new_plvl
---
>   ! real, dimension(:), allocatable :: new_plvl
>   real, dimension(100000) :: new_plvl
74c75
<   allocate(new_plvl(size(new_plvl_in)))
---
>   ! allocate(new_plvl(size(new_plvl_in)))
297c298
<   deallocate(new_plvl)
---
>   ! deallocate(new_plvl)

new_plvlのサイズをどれくらい取ればいいかは不明。

実際のデータで処理したらSegmentation fault (core dumped)になった。
サイズを増やしても回避できない。

採択案

関連: WRF / GFortran > v4.7.7とv4.9.2のバイナリ互換

v4.7.7とv4.9.2の出力ファイルの混在は問題がないと思っている。

以下とした。

  • geogrid.exe : v4.4.7でビルド
  • ungrib.exe : v4.9.2でビルド
  • metgrid.exe : v4.4.7でビルド

v4.9.2で統一するにはnetcdf.modと他のどのmodファイルを作り直すことになるだろうか。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1