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

NF_DEF_VAR_DEFLATE not compiled with netcdf version 4.2.1 #80

Closed
sit23 opened this issue Nov 28, 2018 · 9 comments
Closed

NF_DEF_VAR_DEFLATE not compiled with netcdf version 4.2.1 #80

sit23 opened this issue Nov 28, 2018 · 9 comments
Labels
infrastructure Isca infrastructure: installation, CI, HPC setups priority:low Low-priority task

Comments

@sit23
Copy link
Contributor

sit23 commented Nov 28, 2018

When compiling Isca on a machine in China, we used netcdf 4.2.1 but it could not find the NF_DEF_VAR_DEFLATE command used here:
https://github.com/ExeClim/Isca/blob/master/src/shared/mpp/include/mpp_io_write.inc#L516

By commenting this line out the program compiles fine. Perhaps this is a command that is only present in more recent netcdf installs, and so shouldn't be compiled when using some versions of netcdf 4?

@wanglei5212749
Copy link

Hi, I have checked the netcdf version 4.1.3 and I find that the NF_DEF_VAR_DEFLATE is a netcdff-77 function. The usage of it is to deflate the variable to a small storage. However, there are two prerequisites to use this function. First, the variable to be deflated must has a netCDF-4 feature. Second, this function can't be used when using parallel I/O for writing data.

@sit23
Copy link
Contributor Author

sit23 commented Nov 29, 2018

OK - thanks @wanglei5212749. That's good to know. Given that this function compiles OK with later NETCDF versions, do you think those requirements changed between NETCDF versions?

@wanglei5212749
Copy link

In my view, most of the climate models use a parallel I/O for writing data. And sometimes we use "--disable-netcdf-4" parameter when compile netcdf to avoid some library conflicts. This means we just build a netCDF-3 library without support for the netCDF-4 formats or functions(see here: https://www.unidata.ucar.edu/software/netcdf/docs/getting_and_building_netcdf.html).
In any of this two conditions, we can not use NF_DEF_VAR_DEFLATE function because the interface of NF_DEF_VAR_DEFLATE is not existing in the netcdf library we compiled. and it will cause a compile-error when we compile the model.

@wanglei5212749
Copy link

To avoid this error, We have two ways. (1)we can recompile the netcdf library we used to make it support for the netCDF-4 formats or functions(But still not use the parallel I/O for writing data). (2)we just comment this line to avoid the compile-error and this will not cause any difference to the model simulation performance except that it may have a little large disk storage. Also we can just comment the usage of #ifndef use_netCDF3 directly to avoid the compile-error.

@wanglei5212749
Copy link

OK - thanks @wanglei5212749. That's good to know. Given that this function compiles OK with later NETCDF versions, do you think those requirements changed between NETCDF versions?

In this condition, I think this problem has little relationship with the version we used, But may be caused by that we don't have the netCDF-4 formats or functions supported. Maybe can be tested by another netcdf library with the netCDF-4 formats or functions supported to see if this compile-error still existed.

@gregcolyer
Copy link
Collaborator

gregcolyer commented Nov 29, 2018

I'm not sure I'm following exactly, but option (1) should be what happens normally, i.e. new netCDF features are supported but not used by default (e.g. for created output files). So maybe this is broken by --disable-netcdf-4 and a different workaround for the library conflicts is needed. (Have you tried --disable-dap instead, mentioned in the documentation page linked to above?) According to git blame, the whole of mpp_io_write.inc is from the original GFDL import, so it hasn't changed in 3 years.

@gregcolyer
Copy link
Collaborator

Or under option (2), can you set the flag use_netCDF3 (matching the downgraded library) so that the #ifndef fails as intended?

@wanglei5212749
Copy link

Or under option (2), can you set the flag use_netCDF3 (matching the downgraded library) so that the #ifndef fails as intended?

Yes can set a definition for use_netCDF3 instead.

@dennissergeev dennissergeev added infrastructure Isca infrastructure: installation, CI, HPC setups priority:low Low-priority task labels May 6, 2020
@RuthG
Copy link

RuthG commented Apr 6, 2022

We'll add a mention of this in the debug docs to help users who run into similar issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infrastructure Isca infrastructure: installation, CI, HPC setups priority:low Low-priority task
Projects
None yet
Development

No branches or pull requests

5 participants