metno / emep-ctm

Open Source EMEP/MSC-W model
GNU General Public License v3.0
30 stars 20 forks source link

Compiler error: type mismatch (v5, gfortran) #117

Closed rosagierens closed 1 year ago

rosagierens commented 1 year ago

Hey, I just downloaded the source code for the open source version 5 (catalog.py -R 5.0 -sd) and while compiling with gfortran I get type mismatch errors in the module GridValues_mod:

mpif90 -ffree-line-length-none -fdefault-real-8 -fdefault-double-8 -O2 -I/appl/spack/v018/install-tree/gcc-11.3.0/netcdf-fortran-4.5.4-p6xyan/include -c GridValues_mod.f90
GridValues_mod.f90:2235:17:

 2233 |   CALL MPI_BCAST(k1_met,4*KMAX_MID,MPI_BYTE,0,MPI_COMM_WORLD,IERROR)
      |                 2
 2234 |   CALL MPI_BCAST(k2_met,4*KMAX_MID,MPI_BYTE,0,MPI_COMM_WORLD,IERROR)
 2235 |   CALL MPI_BCAST(x_k1_met,8*KMAX_MID,MPI_BYTE,0,MPI_COMM_WORLD,IERROR)
      |                 1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(8)/INTEGER(4)).
GridValues_mod.f90:2010:17:

 2010 |   CALL MPI_BCAST(x_k1_met,8*KMAX_MID,MPI_BYTE,0,MPI_COMM_WORLD,IERROR)
      |                 1
......
 2233 |   CALL MPI_BCAST(k1_met,4*KMAX_MID,MPI_BYTE,0,MPI_COMM_WORLD,IERROR)
      |                 2
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(8)/INTEGER(4)).
GridValues_mod.f90:533:17:

  533 |   CALL MPI_BCAST(Pole_Singular ,4*1,MPI_BYTE,0,MPI_COMM_WORLD,IERROR)
      |                 1
......
 2233 |   CALL MPI_BCAST(k1_met,4*KMAX_MID,MPI_BYTE,0,MPI_COMM_WORLD,IERROR)
      |                 2
Error: Rank mismatch between actual argument at (1) and actual argument at (2) (rank-1 and scalar)
GridValues_mod.f90:474:17:

  474 |   CALL MPI_BCAST(USES%WRF_MET_NAMES ,1,MPI_LOGICAL,0,MPI_COMM_WORLD,IERROR)
      |                 1
......
 2233 |   CALL MPI_BCAST(k1_met,4*KMAX_MID,MPI_BYTE,0,MPI_COMM_WORLD,IERROR)
      |                 2
Error: Type mismatch between actual argument at (1) and actual argument at (2) (LOGICAL(4)/INTEGER(4)).
GridValues_mod.f90:475:17:

  475 |   CALL MPI_BCAST(IIFULLDOM ,4*1,MPI_BYTE,0,MPI_COMM_WORLD,IERROR)
      |                 1
......
 2233 |   CALL MPI_BCAST(k1_met,4*KMAX_MID,MPI_BYTE,0,MPI_COMM_WORLD,IERROR)
      |                 2
Error: Rank mismatch between actual argument at (1) and actual argument at (2) (rank-1 and scalar)
GridValues_mod.f90:476:17:

  476 |   CALL MPI_BCAST(JJFULLDOM ,4*1,MPI_BYTE,0,MPI_COMM_WORLD,IERROR)
      |                 1
......
 2233 |   CALL MPI_BCAST(k1_met,4*KMAX_MID,MPI_BYTE,0,MPI_COMM_WORLD,IERROR)
      |                 2
Error: Rank mismatch between actual argument at (1) and actual argument at (2) (rank-1 and scalar)
GridValues_mod.f90:477:17:

  477 |   CALL MPI_BCAST(KMAX ,4*1,MPI_BYTE,0,MPI_COMM_WORLD,IERROR)
      |                 1
......
 2233 |   CALL MPI_BCAST(k1_met,4*KMAX_MID,MPI_BYTE,0,MPI_COMM_WORLD,IERROR)
      |                 2
Error: Rank mismatch between actual argument at (1) and actual argument at (2) (rank-1 and scalar)
GridValues_mod.f90:478:17:

  478 |   CALL MPI_BCAST(projection ,len(projection),MPI_BYTE,0,MPI_COMM_WORLD,IERROR)
      |                 1
......
 2233 |   CALL MPI_BCAST(k1_met,4*KMAX_MID,MPI_BYTE,0,MPI_COMM_WORLD,IERROR)
      |                 2
Error: Type mismatch between actual argument at (1) and actual argument at (2) (CHARACTER(*)/INTEGER(4)).
make: *** [Makefile:40: GridValues_mod.o] Error 1

Libraries used: GNU Fortran version 11.3.0 NetCDF version 4.5.4 Open MPI version 4.1.4

I'm using the compiler flags given in the Makefile for gfortran (-ffree-line-length-none -fdefault-real-8 -fdefault-double-8 -O2).

Do you have any suggestions on how to fix/work around the problem?

gitpeterwind commented 1 year ago

Apparently the more recent versions of gfortran are more picky. You can get around by adding the flag -fallow-argument-mismatch in the Makefile: F90FLAGS = -fallow-argument-mismatch -ffree-line-length-none -fdefault-real-8 -fdefault-double-8 -O2

rosagierens commented 1 year ago

Thank you, this solved the problem!

rosagierens commented 1 year ago

Thank you, this solved the problem!