MPAS-Dev / MPAS-Model

Repository for MPAS models and shared framework releases.
241 stars 321 forks source link

Overflow when Compiling MPAS-O #839

Open daniloceano opened 3 years ago

daniloceano commented 3 years ago

Greetings,

First of all, sorry if this is not the right place for posting this kind of issue, but I've seen other similar posts and also the web forum I found seems to be concerned only about the Atmosphere core.

I adapted duda's iolib_installation.sh script for installing the libraries required by the model and (it seems) successfully compiled init_atmosphere and atmosphere cores. However, when I try to compile the Ocean core I get this message:

mpas_ocn_gm.F:198:40:

         gradDensityEdge(k, iEdge) = huge(0D0)
                                    1

Error: Arithmetic overflow converting REAL(8) to REAL(4) at (1). This check can be disabled with the option '-fno-range-check' mpas_ocn_gm.F:199:45:

         gradDensityTopOfEdge(k, iEdge) = huge(0D0)
                                         1

Error: Arithmetic overflow converting REAL(8) to REAL(4) at (1). This check can be disabled with the option '-fno-range-check' mpas_ocn_gm.F:200:44:

         dDensityDzTopOfEdge(k, iEdge) = huge(0D0)
                                        1

Error: Arithmetic overflow converting REAL(8) to REAL(4) at (1). This check can be disabled with the option '-fno-range-check' mpas_ocn_gm.F:201:37:

         gradZMidEdge(k, iEdge) = huge(0D0)
                                 1

Error: Arithmetic overflow converting REAL(8) to REAL(4) at (1). This check can be disabled with the option '-fno-range-check' mpas_ocn_gm.F:202:42:

         gradZMidTopOfEdge(k, iEdge) = huge(0D0)
                                      1

Error: Arithmetic overflow converting REAL(8) to REAL(4) at (1). This check can be disabled with the option '-fno-range-check' mpas_ocn_gm.F:213:45:

         dDensityDzTopOfCell(k,  iCell) = huge(0D0)
                                         1

Error: Arithmetic overflow converting REAL(8) to REAL(4) at (1). This check can be disabled with the option '-fno-range-check' Makefile:201: recipe for target 'mpas_ocn_gm.o' failed

I am using MPICH version 3.3.1, so I set the CC and FC compilers to mpifort and mpicc.

Any suggestions?

Thanks!

xylar commented 3 years ago

@daniloceano, we don't really build or test the ocean model at single precision so it looks like there are places where we're not handling single precision correctly. Unless you have a reason to want to run with single precision, I'd change your build to double.

daniloceano commented 3 years ago

@xylar thank you very much. It worked!

philipwjones commented 3 years ago

Yeah, a more robust way would be to declare a local garbage variable with RKIND that we set to a constant and use that as the argument to HUGE.

klindsay28 commented 3 years ago

Pardon the drive-by comment, but I don't think you need a local garbage variable. You could use HUGE(0.0_RKIND).