Skip to content

SerialBox doesn't seem to understand "module function" or "module subroutine" syntax #261

@christopherwharrop-noaa

Description

When pre-processing a Fortran code with pp_ser.py I get this error:

[ 20%] Preprocessing for serialization
cd /scratch2/BMC/gsd-hpcs/Christopher.W.Harrop/GT4Py/SENA-shallow-water/build/src/fortran && /home/Christopher.W.Harrop/miniconda3/bin/python /scratch2/BMC/gsd-hpcs/Christopher.W.Harrop/GT4Py/serialbox2/src/serialbox-python/pp_ser/pp_ser.py --verbose --ignore-identical --output-dir=/scratch2/BMC/gsd-hpcs/Christopher.W.Harrop/GT4Py/SENA-shallow-water/build/src/fortran/serialbox_pp /scratch2/BMC/gsd-hpcs/Christopher.W.Harrop/GT4Py/SENA-shallow-water/src/fortran/module_netcdf_utils.f90 /scratch2/BMC/gsd-hpcs/Christopher.W.Harrop/GT4Py/SENA-shallow-water/src/fortran/module_shallow_water_kind.f90 /scratch2/BMC/gsd-hpcs/Christopher.W.Harrop/GT4Py/SENA-shallow-water/src/fortran/module_shallow_water_geometry_config.f90 /scratch2/BMC/gsd-hpcs/Christopher.W.Harrop/GT4Py/SENA-shallow-water/src/fortran/module_shallow_water_model_config.f90 /scratch2/BMC/gsd-hpcs/Christopher.W.Harrop/GT4Py/SENA-shallow-water/src/fortran/module_shallow_water_geometry.f90 /scratch2/BMC/gsd-hpcs/Christopher.W.Harrop/GT4Py/SENA-shallow-water/src/fortran/module_shallow_water_state.f90 /scratch2/BMC/gsd-hpcs/Christopher.W.Harrop/GT4Py/SENA-shallow-water/src/fortran/module_shallow_water_model.f90 /scratch2/BMC/gsd-hpcs/Christopher.W.Harrop/GT4Py/SENA-shallow-water/src/fortran/module_shallow_water_tl.f90 /scratch2/BMC/gsd-hpcs/Christopher.W.Harrop/GT4Py/SENA-shallow-water/src/fortran/module_shallow_water_adj.f90
Processing file /scratch2/BMC/gsd-hpcs/Christopher.W.Harrop/GT4Py/SENA-shallow-water/src/fortran/module_netcdf_utils.f90
Processing file /scratch2/BMC/gsd-hpcs/Christopher.W.Harrop/GT4Py/SENA-shallow-water/src/fortran/module_shallow_water_kind.f90
Processing file /scratch2/BMC/gsd-hpcs/Christopher.W.Harrop/GT4Py/SENA-shallow-water/src/fortran/module_shallow_water_geometry_config.f90
Processing file /scratch2/BMC/gsd-hpcs/Christopher.W.Harrop/GT4Py/SENA-shallow-water/src/fortran/module_shallow_water_model_config.f90
Processing file /scratch2/BMC/gsd-hpcs/Christopher.W.Harrop/GT4Py/SENA-shallow-water/src/fortran/module_shallow_water_geometry.f90
Processing file /scratch2/BMC/gsd-hpcs/Christopher.W.Harrop/GT4Py/SENA-shallow-water/src/fortran/module_shallow_water_state.f90
Processing file /scratch2/BMC/gsd-hpcs/Christopher.W.Harrop/GT4Py/SENA-shallow-water/src/fortran/module_shallow_water_model.f90
File: "/scratch2/BMC/gsd-hpcs/Christopher.W.Harrop/GT4Py/SENA-shallow-water/src/fortran/module_shallow_water_model.f90", line 72
Message: Unexpected module statement
Line 72:     module function constructor_tl(config, geometry) result(this)

make[2]: *** [src/fortran/serialbox_pp/module_netcdf_utils.f90] Error 1
make[2]: *** Deleting file `src/fortran/serialbox_pp/module_netcdf_utils.f90'
make[2]: Leaving directory `/scratch2/BMC/gsd-hpcs/Christopher.W.Harrop/GT4Py/SENA-shallow-water/build'
make[1]: *** [src/fortran/CMakeFiles/shallow_water_ser.dir/all] Error 2
make[1]: Leaving directory `/scratch2/BMC/gsd-hpcs/Christopher.W.Harrop/GT4Py/SENA-shallow-water/build'
make: *** [all] Error 2
[Christopher.W.Harrop@Hera:hfe09 build]$ 

The offending line is a declaration of a module function in a module interface block. This code uses Fortran Submodules, which is why "module function" is used here. See line 72 here.

This code is valid Fortran and builds fine with gfortran and Intel. Is this a known limitation of SerialBox? Or a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions