Coder Social home page Coder Social logo

NetCDF-Fortran not linking about mpas-model HOT 11 OPEN

mpas-dev avatar mpas-dev commented on September 3, 2024
NetCDF-Fortran not linking

from mpas-model.

Comments (11)

douglasjacobsen avatar douglasjacobsen commented on September 3, 2024

@cponder: It looks like you're trying to build the atmosphere model, so you should probably look at their users guide

Chapter 3 has instructions for how to build the model, but the short answer to your question is that all netcdf libraries must be installed in the same location and you pass that location using the NETCDF environment variable. Once you set that, all the library information is internally dealt with (i.e. you don't need to set LDFLAGS, LIBS, FFLAGS, or FCFLAGS).

from mpas-model.

cponder avatar cponder commented on September 3, 2024

The PIO, NETCDF and PNETCDF variables are already set in my envoronment.
Note that NetCDF-C and NetCDF-F are no longer bundled-together, and are released with different version numbers.
Do you have a NETCDF_F environment variable?

from mpas-model.

douglasjacobsen avatar douglasjacobsen commented on September 3, 2024

@cponder No, you have to install NetCDF-C and NetCDF-F into the same directory. Even if they have different version numbers.

from mpas-model.

cponder avatar cponder commented on September 3, 2024

Why don't you just fix the Makefile?

from mpas-model.

douglasjacobsen avatar douglasjacobsen commented on September 3, 2024

@cponder Most of our builds use older netcdf libraries that are bundled together. It's possible for us to change the Makefile to have a NETCDF_F flag in the future, but it likely won't happen in a short amount of time.

from mpas-model.

cponder avatar cponder commented on September 3, 2024

I don't get why the compiler doesn't pick up the
-L$NETCDF_F/lib -lnetcdff
settings from the LDFLAGS or FCFLAGS variables, are you clearing these?

from mpas-model.

douglasjacobsen avatar douglasjacobsen commented on September 3, 2024

It's not that we're clearing them. We just don't use them. So, setting these variables doesn't affect the build at all.

from mpas-model.

cponder avatar cponder commented on September 3, 2024

This patch to the top-level Makefile worked:

269 ifneq "$(NETCDF_F)" ""
270         CPPINCLUDES += -I$(NETCDF_F)/include
271         FCINCLUDES += -I$(NETCDF_F)/include
272         LIBS += -L$(NETCDF_F)/lib -lnetcdff
273 endif

Note that (1) it only uses the NETCDF_F it is set, and the

263         ifneq ($(wildcard $(NETCDF)/lib/libnetcdff.*), ) # CHECK FOR NETCDF4

check is still in place, so a merged NetCDF-C + NetCDF-F directory will still work.
Can you add this to your next bugfix release?
The patch doesn't add any autodetecting, you have to explicitly use the NETCDF_F variable.
Also it doesn't force the user to set NETCDF_F, although in the future we might want to remove the libnetcdff autodetection from NETCDF and simply set NETCDF_F=$NETCDF as the default.

from mpas-model.

cponder avatar cponder commented on September 3, 2024

This one changes more lines but I think is cleaner overall

257 ifneq "$(NETCDF)" ""
258         CPPINCLUDES += -I$(NETCDF)/include
259         FCINCLUDES += -I$(NETCDF)/include
260         LIBS += -L$(NETCDF)/lib -lnetcdf
261         ifneq ($(wildcard $(NETCDF)/lib/libnetcdff.*), ) && ifeq "$(NETCDF_F)" "" # CHECK FOR NETCDF4
262                 NETCDF_F=$(NETCDF)
263         endif # CHECK FOR NETCDF4
264 endif
265 
266 ifneq "$(NETCDF_F)" ""
267         CPPINCLUDES += -I$(NETCDF_F)/include
268         FCINCLUDES += -I$(NETCDF_F)/include
269         LIBS += -L$(NETCDF_F)/lib -lnetcdff
270 endif

So $NETCDF_F is used if it is set; otherwise we autodetect the $NETCDF/lib/libnetcdff.* as before.

from mpas-model.

cponder avatar cponder commented on September 3, 2024

Doug -- I'm having trouble building the PIO library with OpenMPI.
Has MPAS-A only been tested with the Intel compiler & Intel MPI?

     -- Carl

This email message is for the sole use of the intended recipient(s) and may contain
confidential information. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact the sender by

reply email and destroy all copies of the original message.

from mpas-model.

mgduda avatar mgduda commented on September 3, 2024

@cponder We've primarily used MPICH with MPAS-Atmosphere, though I believe a number of MPAS-Ocean developers use OpenMPI. Generally, I don't think there's a preference on the MPAS side for any particular MPI implementation. If this is an issue in building PIO, however, you might like to get in contact with the PIO developers, since PIO is a library developed completely independently from MPAS.

from mpas-model.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.