Closed anton-seaice closed 8 months ago
Thank you for opening an issue and providing a test case. I can confirm that this is also happening in the latest pio2.6.2 and I will provide a fix as soon as I can. If you already have a fix and would like to submit a PR it would be gratefully accepted.
@anton-seaice I'm not sure that I understand what is going on. In working with the test case that you provided I found that the cpp macro _NETCDF4 was not defined in the config.h in my build, so I rebuilt and saw that it is now defined and the test works fine. I double checked and I haven't made any changes in the pio source. Can you confirm that _NETCDF4 is defined in your config.h file?
To follow up, the actual failure I had yesterday is because I was setting PIO_TYPENAME=netcdf4p and PIO_NETCDF_DATA_FORMAT=64bit-data which are incompatible options. I will add something to check that and fail with a reasonable error message.
To follow up, the actual failure I had yesterday is because I was setting PIO_TYPENAME=netcdf4p and PIO_NETCDF_DATA_FORMAT=64bit-data which are incompatible options. I will add something to check that and fail with a reasonable error message.
I'm not sure you 'have' to do anything about that, the netcdf library returns a 'NetCDF: Invalid argument' if error handling is set to 'PIO_RETURN_ERROR'
@anton-seaice I'm not sure that I understand what is going on. In working with the test case that you provided I found that the cpp macro _NETCDF4 was not defined in the config.h in my build, so I rebuilt and saw that it is now defined and the test works fine. I double checked and I haven't made any changes in the pio source. Can you confirm that _NETCDF4 is defined in your config.h file?
I can't see how to check that directly, but opening netcdf4 files works fine (and in parallel) and it looks like the right flag is set in cmake.
Hi Jim
Apologies - you have already fixed this!
I updated to version 2.6.2 and my test code passes now.
See
adding the ierr== NC_ENOTBUILT
is probably what did it
Hi
We are updating our model (CICE) to use support netcdf4, and found an issue with backward compatibility of pio_openfile. When opening a netcdf-classic (cdf) file, with iotype set to
PIO_iotype_netcdf4p
, the openfile fails. Our netcdf build does not include parallel-netcdf, so the expected behaviour is that the PIO library will retry a serial read of the netcdf classic file after the parallel read fails.This is the error message: _Abort with message NetCDF: Attempt to use feature that was not turned on when netCDF was built. in file /scratch/tm70/as2285/tmp/spack-stage/spack-stage-parallelio-2.5.10-zz25cmdlouvcwggv7zbkdmeobvz37aja/spack-src/src/clib/piocsupport.c at line 2832
This is the logging from PE 0, the first section looks correct. As a parallel read of netcdf classic file is not supported, and error code -128 is returned.
On the retry, iotype has not been updated. Iotype here is 4 (NETCDF4) but it should be 2 (NETCDF)
Expected result is the file opens using PE 0 only.
Here is my test code:
And the test file: