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 Compile problem

yuzj

New member
Hi all,

I am trying to compile WRF and during that process, there is some question (./compile em_real) . First one is there are many mismatch errors, but I am not sure why. Then it also mentioned a fatal error that is mod and the scripts can not find it. the basic information for my cmpile is (I use gnu compiler and in configure section, I chosse 34 and 1 for nesting setting). If possible, please help me if you are familiar with this area, thanks a lot!

Question 1:
/lib/cpp -P -nostdinc -DEM_CORE=1 -DNMM_CORE=0 -DNMM_MAX_DIM=2600 -DDA_CORE=0 -DWRFPLUS=0 -DIWORDSIZE=4 -DDWORDSIZE=8 -DRWORDSIZE=4 -DLWORDSIZE=4 -DNONSTANDARD_SYSTEM_SUBR -DWRF_USE_CLM -DDM_PARALLEL -DNETCDF -DGRIB2 -DHDF5 -DUSE_ALLOCATABLES -Dwrfmodel -DGRIB1 -DINTIO -DKEEP_INT_AROUND -DLIMIT_ARGS -DBUILD_RRTMG_FAST=1 -DCONFIG_BUF_LEN=65536 -DMAX_DOMAINS_F=21 -DMAX_HISTORY=25 -DNMM_NEST=0 -I. -traditional-cpp -I../inc module_internal_header_util.F > module_internal_header_util.f90
gfortran -c -w -ffree-form -ffree-line-length-none -fconvert=big-endian -frecord-marker=4 module_internal_header_util.f90
module_internal_header_util.f90:1717:39:

1717 | DataHandle, Data, Count, code )
| 1
......
1779 | DataHandle, Data, Count, code )
| 2
Error: Type mismatch between actual argument at (1) and actual argument at (2) (INTEGER(4)/REAL(4)).
module_internal_header_util.f90:1592:39:

1592 | DataHandle, Data, Count, code )
| 1
......
1654 | DataHandle, Data, Count, code )
| 2
Error: Type mismatch between actual argument at (1) and actual argument at (2) (INTEGER(4)/REAL(4)).
module_internal_header_util.f90:1503:39:

1503 | DataHandle, Data, Count, code )
| 1
......
1779 | DataHandle, Data, Count, code )
| 2
Error: Type mismatch between actual argument at (1) and actual argument at (2) (CHARACTER(*)/REAL(4)).
module_internal_header_util.f90:1440:39:

1440 | DataHandle, DummyData, DummyCount, code )
| 1
......
1654 | DataHandle, Data, Count, code )
| 2
Error: Type mismatch between actual argument at (1) and actual argument at (2) (INTEGER(4)/REAL(4)).
module_internal_header_util.f90:1348:39:

1348 | DataHandle, dummyData, DummyCount, code )
| 1
......
1779 | DataHandle, Data, Count, code )
| 2
Error: Type mismatch between actual argument at (1) and actual argument at (2) (CHARACTER(132)/REAL(4)).
module_internal_header_util.f90:1285:41:

1285 | DataHandle, DummyData, DummyCount, code )
| 1
......
1654 | DataHandle, Data, Count, code )
| 2
Error: Type mismatch between actual argument at (1) and actual argument at (2) (INTEGER(4)/REAL(4)).
module_internal_header_util.f90:1132:39:

1132 | DataHandle, Data, Count, code )
| 1
......
1779 | DataHandle, Data, Count, code )
| 2
Error: Type mismatch between actual argument at (1) and actual argument at (2) (INTEGER(4)/REAL(4)).
module_internal_header_util.f90:1068:39:

1068 | DataHandle, Data, Count, code )
| 1
......
1779 | DataHandle, Data, Count, code )
| 2
Error: Type mismatch between actual argument at (1) and actual argument at (2) (INTEGER(4)/REAL(4)).
module_internal_header_util.f90:943:41:

943 | DataHandle, Data, Count, code )
| 1
......
1654 | DataHandle, Data, Count, code )
| 2
Error: Type mismatch between actual argument at (1) and actual argument at (2) (INTEGER(4)/REAL(4)).
module_internal_header_util.f90:853:41:

853 | DataHandle, Data, Count, code )
| 1
......
1654 | DataHandle, Data, Count, code )
| 2
Error: Type mismatch between actual argument at (1) and actual argument at (2) (INTEGER(4)/REAL(4)).
make[2]: [Makefile:177: module_internal_header_util.o] Error 1 (ignored)
mpicc -cc=gcc -DFSEEKO64_OK -c -w -O3 -c -DDM_PARALLEL -DMAX_HISTORY=25 -DNMM_CORE=0 wrf_num_bytes_between.c
rm -f libmassv.o



Question 2:
time mpif90 -f90=gfortran -o module_sf_clm.o -c -O2 -ftree-vectorize -funroll-loops -w -ffree-form -ffree-line-length-none -fconvert=big-endian -frecord-marker=4 -I../dyn_em -I../dyn_nmm -I/localdisk/r091/export/envryuzj/WRF_test/WRF4.0/external/esmf_time_f90 -I/localdisk/r091/export/envryuzj/WRF_test/WRF4.0/main -I/localdisk/r091/export/envryuzj/WRF_test/WRF4.0/external/io_netcdf -I/localdisk/r091/export/envryuzj/WRF_test/WRF4.0/external/io_int -I/localdisk/r091/export/envryuzj/WRF_test/WRF4.0/frame -I/localdisk/r091/export/envryuzj/WRF_test/WRF4.0/share -I/localdisk/r091/export/envryuzj/WRF_test/WRF4.0/phys -I/localdisk/r091/export/envryuzj/WRF_test/WRF4.0/wrftladj -I/localdisk/r091/export/envryuzj/WRF_test/WRF4.0/chem -I/localdisk/r091/export/envryuzj/WRF_test/WRF4.0/inc -I/home/envryuzj/netcdf/include module_sf_clm.f90
module_sf_clm.f90:192:33:

192 | integer, parameter :: bigint = O'17777777777'
| 1
Error: BOZ literal constant at (1) is neither a data-stmt-constant nor an actual argument to INT, REAL, DBLE, or CMPLX intrinsic function [see ‘-fno-allow-invalid-boz’]
module_sf_clm.f90:5651:7:

5651 | use nanMod , only : nan, bigint
| 1
Fatal Error: Cannot open module file ‘nanmod.mod’ for reading at (1): No such file or directory
compilation terminated.
Command exited with non-zero status 1
0.29user 0.05system 0:00.33elapsed 104%CPU (0avgtext+0avgdata 39440maxresident)k
0inputs+152outputs (0major+11229minor)pagefaults 0swaps
make[3]: [../configure.wrf:348: module_sf_clm.o] Error 1 (ignored)
 
Can you attach your configure.wrf file, along with the full compile log. Make sure to attach the files, and not just paste them in the forum. Thanks!
 
Thanks for remind, I have attached my configure.wrf and compile.log.
 

Attachments

  • configure.wrf.txt
    20.3 KB · Views: 4
  • compile.log
    82.8 KB · Views: 3
Thanks for attaching those. It looks like the compiler errors are specific to WRF-chem. I'm going to move this thread to the WRF-chem section of the forum so that someone from that support group may be able to help.
 
Thanks for attaching those. It looks like the compiler errors are specific to WRF-chem. I'm going to move this thread to the WRF-chem section of the forum so that someone from that support group may be able to help.
Thank you so much and hope it can be solved.
 
Hi, My operating system is
Operating System: Rocky Linux 9.4 (Blue Onyx)
CPE OS Name: cpe:/o:rocky:rocky:9::baseos
Kernel: Linux 5.14.0-427.22.1.el9_4.x86_64
Architecture: x86-64
The library list:
1721977278919.png

If you have any idea to solve that, I'd appreciate it very much.
 
If it's gcc --version and gfortran --version is greater than 9.0.0 follow these reccomendations

 
If it's gcc --version and gfortran --version is greater than 9.0.0 follow these reccomendations

Sorry for reply late. I think the gcc version is ( gcc (GCC) 11.4.1 20231218 (Red Hat 11.4.1-3)) and GNU Fortran (GCC) 11.4.1 20231218 (Red Hat 11.4.1-3). Thank you so much.
 
Sorry for reply late. I think the gcc version is ( gcc (GCC) 11.4.1 20231218 (Red Hat 11.4.1-3)) and GNU Fortran (GCC) 11.4.1 20231218 (Red Hat 11.4.1-3). Thank you so much.
Okay GCC is greater than 9, which means that you are having a fallow argument mismatch.

That link to the post about how to fix it should solve all your problems.
 
Okay GCC is greater than 9, which means that you are having a fallow argument mismatch.

That link to the post about how to fix it should solve all your problems.
Thank you so much and sorry to disturb again. The BOZ problem has been solved. I found there is still mismatch and some mod missing problem during my compile. Whether it because my bashrc setting problem?1722224185362.png
 
not 100% certain but it may be because you have FCFLAGS and FFLAGS in there twice.
Thank you so much, I have modified it and the boz problem has been solved but the mod missing problem still exists. Thank you again for your patient help. I will check how to solve the mod missing problem.
 

Attachments

  • compile.log
    812.1 KB · Views: 1
Code:
gfortran   -O2 -ftree-vectorize -funroll-loops -w -ffree-form -ffree-line-length-none -fconvert=big-endian -frecord-marker=4  -o wrf_io.o -O2 -ftree-vectorize -funroll-loops -w -ffree-form -ffree-line-length-none -fconvert=big-endian -frecord-marker=4  -I/home/envryuzj/netcdf/include -I../ioapi_share -c wrf_io.f
wrf_io.f:1498:36:

 1498 |   CALL ext_ncd_open_for_read_begin( DatasetName, Comm1, Comm2, SysDepInfo, DataHandle, Status )
      |                                    1
Error: Dummy argument ‘datasetname’ with INTENT(IN) in variable definition context (actual argument to INTENT = OUT/INOUT) at (1)
wrf_io.f:7454:58:

 3162 |       stat = NF_PUT_ATT_INT (DH%NCID,NF_GLOBAL,Element,NF_INT,Count,Data)
      |                                                                    2
......
 7454 |     stat = NF_PUT_ATT_INT(NCID,VarID,'FieldType',NF_INT,1,FieldType)
      |                                                          1
Error: Rank mismatch between actual argument at (1) and actual argument at (2) (rank-1 and scalar)
wrf_io.f:7516:71:

 7516 |                                                    ,i1,i2,j1,j2,k1,k2 )
      |                                                                       1
Error: Type mismatch in argument ‘field’ at (1); passed INTEGER(4) to REAL(8)
wrf_io.f:7655:49:

 2504 |     stat = NF_GET_ATT_INT (DH%NCID,NF_GLOBAL,Element,Buffer)
      |                                                     2
......
 7655 |     stat = NF_GET_ATT_INT(NCID,VarID,'FieldType',FType)
      |                                                 1
Error: Rank mismatch between actual argument at (1) and actual argument at (2) (rank-1 and scalar)
wrf_io.f:8117:52:

 2504 |     stat = NF_GET_ATT_INT (DH%NCID,NF_GLOBAL,Element,Buffer)
      |                                                     2
......
 8117 |     stat = NF_GET_ATT_INT(DH%NCID,VarID,'FieldType',WrfType)
      |                                                    1
Error: Rank mismatch between actual argument at (1) and actual argument at (2) (rank-1 and scalar)
make[3]: [makefile:28: wrf_io.o] Error 1 (ignored)

It looks like wrf_io.o is not getting those flags applied. For version v4.0, external/io_netcdf/makefile overwrites FFLAGS as $(FCFLAGS) -I$(NETCDFPATH)/include -I../ioapi_share

This looks like it should work, but the arch/preamble sets FCFLAGS as FCFLAGS = $(FCOPTIM) $(FCBASEOPTS). The reason this gets applied before before the environment variable even though external/io_netcdf/makefile does not include ./configure.wrf is because the top-level makefile does do the include before the evaluation of any rule.

In the latest log, none of the additional flags are present in the compile lines. The best way to ensure the flags are used would be to modify the configure.wrf file after ./configure but before ./compile - not ideal but a workaround if staying on the current version of WRF is necessary.

@yuzj I noticed that between all the logs, some use the NMM core and others don't. If it's possible, moving to a newer version of WRF will solve these issues (for the BOZ and rank mismatch v4.2.2 or higher). I believe newer versions no longer support the NMM core, so if you need that then the above recommendation to modify configure.wrf is a valid workaround. If chemistry coupling is the primary concern and there aren't significant differences in capabilities to your application, moving to the latest version would be best.
 
Top