0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

WRF / gfortran > Error: NAMELIST attribute conflicts with ALLOCATABLE attribute > gfortranのバージョンv4.4.7で発生 | v4.6以降で修正済?

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。

WPSのungrib.exeをgfortranでコンパイルしようとして以下のようなエラーが出ている。

Makefile:90: warning: overriding commands for target `.F.o'
../../configure.wps:103: warning: ignoring old commands for target `.F.o'
Makefile:95: warning: overriding commands for target `.c.o'
../../configure.wps:95: warning: ignoring old commands for target `.c.o'
/usr/bin/cpp -P -traditional -D_UNDERSCORE -DBYTESWAP -DLINUX -DIO_NETCDF -DBIT32 -DNO_SIGNAL -D_MPI -D_UNGRIB -DUSE_JPEG2000 -DUSE_PNG read_namelist.F > read_namelist.f90
gfortran -c -ffree-form -O -fconvert=big-endian -frecord-marker=4 read_namelist.f90
read_namelist.f90:72.25:

       add_lvls, new_plvl, interp_type
                         1
Error: NAMELIST attribute conflicts with ALLOCATABLE attribute in 'new_plvl' at (1)
read_namelist.f90:238.20:

案 > コンパイルオプションでの対応 > 失敗

以下が関連しそう。
https://groups.google.com/forum/#!topic/gg95/cO9AiFtaeH4

The f95 standard forbids having allocatable arrays as namelist group objects. The f2003 standard allows it. The problem is that g95 is a f95 compiler with some f2003 features but not including that one. Gfortran gives you the choice. With the -std=f95 option you get an error message equivalent to g95's, with -std=f2003 (or with no -std option at all) the program compiles.

-- John Harper

f95(g95)ではダメで、GFortran(f2003機能)を使わないといけないようだ。

WPS v3.7.1では問題がなかったが、v3.9のコードではこのあたりがきちんと検討されていないようだ。

gfortran v4.4.7-17(とv4.9)で-std=f2003オプションを付けてもダメだった。

案 > GFortranのバージョン変更

v4.4.7-17: 上記の問題が発生する
v4.9.2-6: 上記の問題は発生しない

v4.9.2-6についてはCentOS 6 で C++11 に対応した g++ を使うを参考にsclを使って切替できるようにした。

$sudo yum install devtoolset-3-gcc-gfortran

関連リンク

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43062
v4.6以降で修正されているようだ。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?