metno / emep-ctm

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

Error compiling EMEP_MSC_W with gfortran. #43

Closed JessMBemep closed 5 years ago

JessMBemep commented 5 years ago

Hi, I am trying to compile EMEP_MSC_W. I already downloaded the code sources, the complementary data and tools. But some bugs arise when compiling. See detailed description bellow. I see that you solved a similar issue in june 2018: https://github.com/metno/emep-ctm/issues/38 It seems you solved it in an specific dev version. Could you please indicate me what is the version (github path) that I have to download? (I'm currently compiling OpenSource rv4.17 (201802)) Many thanks in advance Best regards

Jessie

  1. Met_ml.f90:3117.5:

    if(met(ix)%found == .false.) then 1 Error: Logicals at (1) must be compared with .eqv. instead of == make: *** [Met_ml.o] Error 1

NOTE: It disappears when substituting the logical sentences

  1. EmisDef_ml.f90:104.56:

    integer, save, dimension(NSECTORS_SNAP,3) ::snap2gnfr=(/1,3,2,4,13,5,6,7,10, 1 Error: Incompatible ranks 2 and 1 in assignment at (1) make: *** [EmisDef_ml.o] Error 1

NOTE: It disappears when uncomment line 103 and comment 104 ! integer, save, dimension(NSECTORS_SNAP) ::snap2gnfr=(/1,3,2,4,13,5,6,7,10,11,-1/)

  1. CellMet_ml.f90:212.14:

       if(z0_out_ix) d_2d(z0_out_ix,i,j,IOU_INST) = &
          1

    Error: IF clause at (1) requires a scalar LOGICAL expression CellMet_ml.f90:221.14:

       if(z0_out_ix) d_2d(z0_out_ix,i,j,IOU_INST) = &
          1

    Error: IF clause at (1) requires a scalar LOGICAL expression make: *** [CellMet_ml.o] Error 1

NOTE: From: https://oss.deltares.nl/web/xbeach/forum/-/message_boards/message/456419 Some compilers (intel) support if statements with integers, some (gfortran) don't. In this case someone was probably using the intel compiler and not aware that using integers as logicals is an intel specific extension. I updated the code in subversion. line 212: if(z0_out_ix == 1) line 221: if(z0_out_ix == 1)

  1. CM_ChemRates_ml.f90:137.32:

    rct(68,:) = 1450000000000exp(-10688TINV) 1 Error: Integer too big for its kind at (1). This check can be disabled with the option -fno-range-check make: *** [CM_ChemRates_ml.o] Error 1

avaldebe commented 5 years ago

Hi @JessMBemep As you wrote some of this issues are solved on our development/research code, so I am confident that they wont show up on our next model release.

In the meantime, I'll implement the changes needed to compile on gfortran 5.4.0 and push them to the code branch and will comment again when this is ready.

avaldebe commented 5 years ago

Hi again, Just pushed the changes. You need to go to the source branch and get the code from there. Please close the issue if this solves your problems.

Cheers, Á.

JessMBemep commented 5 years ago

Many thanks, I'll be waiting for your mods.

regards Jessie

avaldebe commented 5 years ago

Just pushed the changes. You need to go to the source branch and get the code from there.

Alternatively, you can clone the branch with the following command:

git clone git@github.com:metno/emep-ctm.git --branch source --single-branch rv4_17_gfortran
JessMBemep commented 5 years ago

It works :-) Thanks a lot

fipoucat commented 5 years ago

I was compiling with gfortran and was getting error then see this post.

Itried to clone the program as suggested here but not working 👍 git clone git@github.com:metno/emep-ctm.git --branch source --single-branch rv4_17_gfortran

with the following:

inclonsistancey between the host name and certificate requ^ete HTTP request on queue no response...404 Not Found 2019-02-03 15:30:50 ERREUR 404: Not Found.

gitpeterwind commented 5 years ago

Don't know what is wrong here. For the time being, you could download an exact copy from my private repository: git clone https://github.com/gitpeterwind/emep-ctm.git --branch source --single-branch rv4_17_gfortran

gitpeterwind commented 5 years ago

or perhaps try also with git clone https://github.com/metno/emep-ctm.git --branch source --single-branch rv4_17_gfortran

fipoucat commented 5 years ago

I cloned now but still get error: looks mismatch somewhere

mpif90 -ffree-line-length-none -fdefault-real-8 -O3 -I//anaconda/include -c MPI_Groups_ml.f90
MPI_Groups_ml.f90:29:4:

 use mpi,only: MPI_REAL8,MPI_DOUBLE_PRECISION,MPI_DOUBLE_COMPLEX,&
    1
Fatal Error: Cannot read module file 'mpi.mod' opened at (1), because it was created by a different version of GNU Fortran
compilation terminated.
make: *** [MPI_Groups_ml.o] Error 1
gitpeterwind commented 5 years ago

it seems that you have compiled the MPI library with a different compiler version

fipoucat commented 5 years ago

Manage to set the path to mpif90 but complain about netcdf:

mpif90 -ffree-line-length-none -fdefault-real-8 -O3 -I//anaconda/include -c PhysicalConstants_ml.f90
gfortran: warning: couldn’t understand kern.osversion ‘18.2.0
mpif90 -ffree-line-length-none -fdefault-real-8 -O3 -I//anaconda/include -c AeroFunctions.f90
gfortran: warning: couldn’t understand kern.osversion ‘18.2.0
mpif90 -ffree-line-length-none -fdefault-real-8 -O3 -I//anaconda/include -c SmallUtils_ml.f90
gfortran: warning: couldn’t understand kern.osversion ‘18.2.0
mpif90 -ffree-line-length-none -fdefault-real-8 -O3 -I//anaconda/include -c Precision_ml.f90
gfortran: warning: couldn’t understand kern.osversion ‘18.2.0
mpif90 -ffree-line-length-none -fdefault-real-8 -O3 -I//anaconda/include -c NumberConstants.f90
gfortran: warning: couldn’t understand kern.osversion ‘18.2.0
mpif90 -ffree-line-length-none -fdefault-real-8 -O3 -I//anaconda/include -c OwnDataTypes_ml.f90
gfortran: warning: couldn’t understand kern.osversion ‘18.2.0
mpif90 -ffree-line-length-none -fdefault-real-8 -O3 -I//anaconda/include -c Io_Nums_ml.f90
gfortran: warning: couldn’t understand kern.osversion ‘18.2.0
mpif90 -ffree-line-length-none -fdefault-real-8 -O3 -I//anaconda/include -c CM_ChemSpecs_ml.f90
gfortran: warning: couldn’t understand kern.osversion ‘18.2.0
mpif90 -ffree-line-length-none -fdefault-real-8 -O3 -I//anaconda/include -c ChemSpecs_wrapper.f90
gfortran: warning: couldn’t understand kern.osversion ‘18.2.0
mpif90 -ffree-line-length-none -fdefault-real-8 -O3 -I//anaconda/include -c MPI_Groups_ml.f90
gfortran: warning: couldn’t understand kern.osversion ‘18.2.0
mpif90 -ffree-line-length-none -fdefault-real-8 -O3 -I//anaconda/include -c CheckStop_ml.f90
gfortran: warning: couldn’t understand kern.osversion ‘18.2.0
CheckStop_ml.f90:41.4:

use netcdf, only: NF90_NOERR,NF90_STRERROR
    1
Fatal Error: File 'netcdf.mod' opened at (1) is not a GNU Fortran module file
make: *** [CheckStop_ml.o] Error 1
fipoucat commented 5 years ago

it looks an os problem, I am using OSX and maybe someone who compiled a such systems could help