Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
christopherwharrop-noaa opened this issue Aug 30, 2022 · 1 comment

Comments

@christopherwharrop-noaa
Copy link

christopherwharrop-noaa commented Aug 30, 2022

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?

@havogt
Copy link
Collaborator

havogt commented Oct 3, 2022

Thanks for your report and sorry for my late reply.

I would classify this as a bug. Unfortunately, we cannot easily invest resources to fix problems appearing in codes outside of our collaborations.

However, this is an open source project and we happily take contributions to improve Serialbox (after signing the contributor agreement).

Alternatively, it might increase the chance to get a fix if you provide a minimal standalone example that reproduces the issue (stackoverflow style https://stackoverflow.com/help/minimal-reproducible-example).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants