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

Import netcdf constants for netcdf-only builds #205

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

amametjanov
Copy link
Contributor

When PIO is built without pnetcdf, fill value constants NF_FILL_INT, NF_FILL_CHAR etc. are not included. This update fixes build errors in such cases.

[BFB]

@mgduda mgduda self-requested a review April 12, 2019 17:27
@mgduda
Copy link
Contributor

mgduda commented Apr 12, 2019

We've found it necessary to make similar changes when using the MPAS-A dycore in CAM/CESM: mgduda@291176d . I'd like to see whether we can reconcile the changes in this PR with those made in commit 291176d.

@amametjanov
Copy link
Contributor Author

That also eliminated build errors. Can you push that to develop?

@mgduda
Copy link
Contributor

mgduda commented Apr 12, 2019

@amametjanov Thanks very much for checking! I'll make a PR to develop with a more descriptive commit message.

@mgduda
Copy link
Contributor

mgduda commented Apr 16, 2019

@amametjanov The problem with the change in 291176d is that it apparently doesn't work when the PIO1 library was compiled with support for only the parallel-netcdf library:

mpif90 -D_MPI -DUNDERSCORE -DCORE_INIT_ATMOSPHERE -DMPAS_NAMELIST_SUFFIX=init_atmosphere -DMPAS_EXE_NAME=init_atmosphere_model -DMPAS_NATIVE_TIMERS -DMPAS_GIT_VERSION=v6.2-122-ge8b87ad-dirty -O3 -m64 -ffree-line-length-none -fconvert=big-endian -ffree-form -fdefault-real-8 -fdefault-double-8 -c mpas_io.F -I/dev/shm/pio-gnu/include -I/dev/shm/pnetcdf-gnu/include -I/dev/shm/pio-gnu/include -I/dev/shm/pnetcdf-gnu/include -I../external/esmf_time_f90
mpas_io.F:30:43:

    integer, parameter :: MPAS_INT_FILLVAL = NF90_FILL_INT
                                           1
Error: Parameter ‘nf90_fill_int’ at (1) has not been declared or is a variable, which does not reduce to a constant expression
mpas_io.F:31:46:

    character, parameter :: MPAS_CHAR_FILLVAL = NF90_FILL_CHAR
                                              1
Error: Parameter ‘nf90_fill_char’ at (1) has not been declared or is a variable, which does not reduce to a constant expression
mpas_io.F:44:54:

    real (kind=RKIND), parameter :: MPAS_REAL_FILLVAL = NF90_FILL_DOUBLE
                                                      1
Error: Parameter ‘nf90_fill_double’ at (1) has not been declared or is a variable, which does not reduce to a constant expression

So, it seems that something a little more sophisticated may be needed to handle the various ways that the PIO1 library might be built.

@amametjanov
Copy link
Contributor Author

In E3SM, pio1+parallel_netcdf (no serial netcdf) option is not supported: either pio1+netcdf, or pio1+netcdf+pnetcdf only.

@mgduda
Copy link
Contributor

mgduda commented Apr 16, 2019

We do support PIO1 + pnetcdf for stand-alone MPAS-A, so I think we'll need to come up with a solution that supports all three variants of PIO1 builds (netcdf, netcdf+pnetcdf, pnetcdf). My first thought is that we could set additional cpp macros (to be added to CPPFLAGS) based on information gathered in the top-level Makefile. The difficulty is that, although a netCDF library may be present in the build environment, PIO might not necessarily have been compiled with netCDF support. I'll give this more thought.

@jonbob
Copy link
Contributor

jonbob commented Mar 18, 2020

@mgduda - have you had any luck with this? We're running into a situation in E3SM in which we need this to function on some specific platforms.

@mgduda
Copy link
Contributor

mgduda commented Mar 24, 2020

@jonbob @amametjanov Sorry for losing track of this issue. Does the E3SM build environment already define macros that would allow us to determine whether we're building within E3SM? If so, would it work for you all to wrap the include 'netcdf.inc' statement inside an E3SM-specific macro?

@jonbob
Copy link
Contributor

jonbob commented Mar 30, 2020

@mgduda - thanks for jumping back in. Right now we don't define any E3SM macros for the MPAS build, though we do for CIME and some other places -- so it is possible. If you feel strongly, I can pursue adding the flags to the MPAS build as well.

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

Successfully merging this pull request may close these issues.

3 participants