WRF icon indicating copy to clipboard operation
WRF copied to clipboard

Compilation error for WRF 4.0 on ubuntu 1604/1804

Open shijin-aws opened this issue 4 years ago • 6 comments

We hit internal compiler error when compiling em_real case for WRF 4.0 on ubuntu 1604/1804 (and amazon linux2):

module_ra_rrtmg_swk.f90
module_ra_rrtmg_swk.f90:3264:0:
    use rrsw_kg20_k, only : absa, ka, absb, kb, forref, selfref,                  &
 1
internal compiler error: in gfc_trans_use_stmts, at fortran/trans-decl.c:4689
Please submit a full bug report,

This error happens randomly so I use a for loop to reproduce it. On Ubuntu1604, I used spack to install netcdf-fortran with openmpi. The configure.wrf is obtained by choosing answer 34 (dmpar) and 1(basic) when ./configure, and I do ./compile em_real and ./clean -a in each iteration to install/uninstall wrfv.exe. I can hit the failure case randomly with the error message showed above in some iteration of my for loop.

export NETCDF=$(spack location -i netcdf-fortran)
pushd $WRF_ROOT
for trial_time in $(seq 20); do
    cp /fsx/configure.wrf $WRF_ROOT
    ./compile -j 1 em_real 2>&1 | tee build.log
    if [ -f "$WRF_ROOT/main/wrf.exe" ]; then
        echo "Trial time: ${trial_time}. Great! wrf.exe is found!"
    else
        echo "Trial time: ${trial_time}. Error! wrf.exe is not found!"
        exit 1
    fi
    ./clean -a
done
popd

I checked the WRF4.0 known problem: https://github.com/wrf-model/WRF/wiki/WRF-Known-Problems---V4.0. I find the error

module_ra_rrtmg_swf.f90:5612:0:
use rrsw_kg21_f, only : kao, kbo, selfrefo, forrefo, sfluxrefo, &
internal compiler error: in gfc_trans_use_stmts, at fortran/trans-decl.c:4920
module_ra_rrtmg_swf.f90:5612:0: internal compiler error: Abort trap: 6 gfortran: internal compiler error: Abort trap: 6 (program f951)

is hit when ./configure -D. But I didn't have -D option in my ./configure. I also tried to remove the -DBUILD_RRTMG_FAST=1 \ from my configure.wrf but it doesn't solve my issue.

My GCC version is 5.4.0.

$ gfortran --version
GNU Fortran (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING

And OpenMPI version is 4.0.3

$ mpirun --version
mpirun (Open MPI) 4.0.3
Report bugs to http://www.open-mpi.org/community/help/

shijin-aws avatar Jun 11 '20 17:06 shijin-aws

configure.wrf.txt configure.wrf attached here.

shijin-aws avatar Jun 11 '20 17:06 shijin-aws

Build log is here: build.log

shijin-aws avatar Jun 11 '20 17:06 shijin-aws

@shijin-aws Shi Jin, Since this is ubuntu, is this a small desktop or laptop machine? If so, take a look at this github README file: https://github.com/davegill/wrf-coop/blob/master/README_tutorial.md

This describes how to use the WPS and WRF systems from within a docker container. This container uses GNU9, which fixed the internal compiler error that you are seeing.

davegill avatar Jun 11 '20 17:06 davegill

@davegill Hi, it's an AWS EC2 instance with ubuntu1604 AMI.

shijin-aws avatar Jun 11 '20 17:06 shijin-aws

So the error is due to the GNU version (5.4) is too old?

shijin-aws avatar Jun 11 '20 17:06 shijin-aws

@shijin-aws @kkeene44 Shi Jin, Move this question to the WRF Forum: forum.mmm.ucar.edu

Mention that this is an AWS instance. We have pre-configure instances for users.

davegill avatar Jun 11 '20 17:06 davegill