Skip to content

Help with mixed-precision FMS (in GEOS) #1621

@mathomp4

Description

@mathomp4

In GEOS, we've always done rather crazy things to support our use of FMS because we build our FV3 core at r4 but MOM6 requires r8. So we've built both fms_r4 and fms_r8 and then done CMake include and link shenanigans to get things working.

Since FMS has been working on mixed-precision support, I decided to try it out with GEOS. And I hit a build issue but I'm not sure if it's "You built FMS wrong" or "An interface is missing". I'm suspecting the latter, but it can easily be the former.1

First, I built FMS using (less the netcdf bits):

-D32BIT=ON -DFPIC=ON -DCONSTANTS=GEOS -DUSE_DEPRECATED_IO=ON

and that gave me a libfms_r4 library. This seemed to be what I want to do, right?

If so, when I go to build GEOS I get:

[  0%] Building Fortran object src/Components/@GEOSgcm_GridComp/GEOSogcm_GridComp/@GEOS_OceanGridComp/MOM6_GEOSPlug/mom6_cmake/CMakeFiles/mom6.dir/__/@mom6/config_src/infra/FMS2/MOM_diag_manager_infra.F90.o
/Users/mathomp4/Models/GEOSgcm-v12-FMSMixedPrec/src/Components/@GEOSgcm_GridComp/GEOSogcm_GridComp/@GEOS_OceanGridComp/MOM6_GEOSPlug/@mom6/config_src/infra/FMS2/MOM_diag_manager_infra.F90:444:71:

  444 |   call FMS_diag_field_add_attribute(diag_field_id, att_name, att_value)
      |                                                                       1
Error: There is no specific subroutine for the generic 'diag_field_add_attribute' at (1)
/Users/mathomp4/Models/GEOSgcm-v12-FMSMixedPrec/src/Components/@GEOSgcm_GridComp/GEOSogcm_GridComp/@GEOS_OceanGridComp/MOM6_GEOSPlug/@mom6/config_src/infra/FMS2/MOM_diag_manager_infra.F90:414:71:

  414 |   call FMS_diag_field_add_attribute(diag_field_id, att_name, att_value)
      |                                                                       1
Error: There is no specific subroutine for the generic 'diag_field_add_attribute' at (1)

Now, since I compile MOM6 as r8, then everything going into that routine would be r8 as well and from my reading of that routine in FMS:

!> @brief Add a attribute to the output field
!> @ingroup diag_manager_mod
INTERFACE diag_field_add_attribute
MODULE PROCEDURE diag_field_add_attribute_scalar_r
MODULE PROCEDURE diag_field_add_attribute_scalar_i
MODULE PROCEDURE diag_field_add_attribute_scalar_c
MODULE PROCEDURE diag_field_add_attribute_r1d
MODULE PROCEDURE diag_field_add_attribute_i1d
END INTERFACE diag_field_add_attribute

is that it doesn't have r4 and r8 variants of the real routines. But again, I might be building wrong.

Any advice/criticism is greatly appreciated.

Footnotes

  1. It could also be "You are building MOM6 wrong" as well. I see they have an OVERLOAD_R8 in MOM_diag_manager_infra.F90, but since we are explicitly compiling at r8, that wouldn't be necessary. (I did try it and got an ambiguous interface as expected.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue/PR that reports or fixes a given discovered bugquestion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions