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

Autoconf netCDF flag update #1272

Merged
merged 5 commits into from
Dec 18, 2020
Merged

Conversation

marshallward
Copy link
Collaborator

This cleans up some issues related to netCDF flag support which were needed to get FMS 2020.04 built correctly.

Specifically, this PR is more careful with the handling of C and Fortran flags, and tries to isolate the flags a little more correctly. It also only conditionally checks nc-config and nf-config, and tries its best to rely on existing environment variables (e.g. CPATH) or user-configured flags when possible.

This does not update the default FMS version to 2020.04, but we could do that if desired. All the tests appear to be passing on various platforms with 2020.04. This is separate from the MOM6-examples update.

marshallward and others added 3 commits December 10, 2020 19:43
This patch trims some of the netCDF flag management and adds more
explicit tests for the FMS and MOM6 flags.

- We only test for -I flags when compiling the FMS library, since links
  are not required at compile-time.

  (NOTE: This may need verification for static builds on Gaea).

- Further separation of C and Fortran flags.

- libnetcdf support is explicitly added to MOM6.  Previously it was not
  tested and linked.   This is in preparation for FMS 2020.04 support.
The --cflags/--fflags arguments of nc-config/nf-config can be volatile,
since they generally represent library install-time flags, so we instead
replace them with --includedir/--libdir flags, which explicitly denote
the installation paths.

The only real issue here is that nf-config does not have a --libdir
flag, so we use $(nf-config --prefix)/lib and hope that this is where
it's installed.
@underwoo
Copy link
Contributor

@marshallward please look at the netcdf m4 macro in FRE-NCtools. I made some extensive modifications that may be useful.

@marshallward
Copy link
Collaborator Author

Thanks Seth, I'm looking through them now. It looks like you also encountered a lot of similar problems with many of the flags (--flibs mashing -L and -l together, for example), and had to parse our the relevant bits.

I was doing something a bit similar (though nowhere near as thorough) but eventually abandoned that approach due to problems on some platforms. (Mostly working around the user's implicit settings at install time, as far as I could tell). Unlike the other flags, the --prefix based seemed to be more reliably defined.

After running this on a few different platforms, the safest option seemed to be to just avoid those other flags and use --includedir and --libdir, and falling back to --prefix if those are unavailable.

If I can get some time, I'll give your macros a try and see how they fare.


BTW the impetus here is that we were not linking to the netCDF C library (-lnetcdf), only the Fortran netCDF library, since for whatever reason it was not needed. But it seems FMS 2020.04 does invoke the library now (presumably something in read_mosaic.c).

The verification tests in .testing are updated to run on FMS 2020.04.

Also, several documentation outputs in .gitignore were moved to
docs/.gitignore, as well as some older files and directories that were
interfering with content in ac/deps.
@codecov-io
Copy link

codecov-io commented Dec 11, 2020

Codecov Report

Merging #1272 (008af9a) into dev/gfdl (e7e6c4a) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           dev/gfdl    #1272   +/-   ##
=========================================
  Coverage     45.78%   45.78%           
=========================================
  Files           225      225           
  Lines         71458    71458           
=========================================
  Hits          32714    32714           
  Misses        38744    38744           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e7e6c4a...008af9a. Read the comment docs.

@adcroft adcroft merged commit 1f38235 into mom-ocean:dev/gfdl Dec 18, 2020
@marshallward marshallward deleted the ac_ncflag_update branch January 18, 2021 12:43
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

Successfully merging this pull request may close these issues.

4 participants