Overflow when Compiling MPAS-O
Opened this issue · 4 comments
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!
@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.
@xylar thank you very much. It worked!
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.
Pardon the drive-by comment, but I don't think you need a local garbage variable.
You could use HUGE(0.0_RKIND)
.