Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

WRF v4.1 compilation

This post was from a previous version of the WRF&MPAS-A Support Forum. New replies have been disabled and if you have follow up questions related to this post, then please start a new thread from the forum home page.

RobWaters

Member
Hi WRF team,

Trying to compile the new V4.1 WRF and struggling to compile.

Fatal Error: Can't find an intrinsic module named 'ieee_arithmetic' at (1)

Which can be solved upgrading to gcc/gfortran version >= 5.0.

The issue is it this seems to break compiling the openMPI:

Fatal Error: Cannot read module file ‘mpi.mod’ opened at (1), because it was created by a different vers$
compilation terminated

Linux version
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"

gcc/gfortran from devtoolset-7

OpenMPI via EPEL
yum install -y epel-release
yum -y install netcdf-openmpi-devel.x86_64 netcdf-fortran-openmpi-devel.x86_64 netcdf-fortran-openmpi.x86_64 hdf5-openmpi.x86_64 openmpi.x86_64 openmpi-devel.x86_64

Is there a better way to get the openmpi requirements?

Thanks in advance for any help,

Rob
 
Rob,
Part of the recent modifications to the WRF code includes an effort to make the Fortran more compliant to the standard. Part of the standardization is removing some extensions that tried to detect NaN values. There is an IEEE intrinsic module (described in the 2003 standard) that has a large number of functions, and one of those detects NaN values.

The problem is that once we made this modification, the standard GNU compiler version on a number of Linux platforms is not new enough to support the usage of the IEEE_arithmetic capability. It is fairly easy for users to upgrade the GNU compiler (for example, GNU 7). However, once that is done, there are a few locations inside of WRF and WPS that utilize the "USE association" technique to bring in module data (such as for MPI or NETCDF). These libraries (and importantly, the module files associated with the compiled Fortran files) were built with the original GNU compiler on the machine. At compile time, the GNU compiler identifies the module files from MPI or NETCDF as being built with a different version of the compiler, and stops.

There are two solutions:
1. Rebuild the impacted libraries. For WRF, this would be NETCDF and your particular MPI choice.
2. For WRF, there is a set of modifications that replaces the modern Fortran way of bringing symbols into a subroutine with the old style (for example, "use mpi" is sort of replaced by "include mpif.h"). I have found that I can build and run WRF with a new compiler (GNU 7) and still use the NETCDF and MPI libs built with the older GNU compiler. Take a look at https://github.com/wrf-model/WRF/pull/803. This PR uses release-v4.1 as the base branch, so the changes should go into your version of the WRF code without much trouble. Note that this will not address the WPS build, if you are also having troubles with WPS.

Dave
 
hi Dave,

Thank you very much for taking the time to put together such an informative answer. I will look into both solutions.

Much appreciated,

Rob
 
We met the same problem with WRF4.1.

Fatal Error: Can't find an intrinsic module named 'ieee_arithmetic' at (1)

Since our system can't be update to GFORTRAN 5, (it is part of the gcc package, and many libraries are supported by it), is there a way to around it? We have asked students to download the tar ball. WRF 3* and WRF4.0 can be compiled on our system.

Students are quite excited about the github distribution.

Thanks,

Qian
 
Top