During debugging of a PIO error in the Polaris tests, I identified two potential bugs in the Omega IOStream and IO module that could explain the issue.
Bug 1: Hard-coded NetCDF format ignores omega.yml
In IOStream.cpp, there are two calls like:
IO::openFile(InFileID, InFileName, Mode, IO::FmtDefault, ExistAction);
IO::FmtDefault is a compile-time constant defined in IO.h (currently netcdf4c).
As a result, the NetCDF format specified in omega.yml is ignored, and files are always opened as netcdf4c.
Bug 2: Global NetCDF format variable is shadowed
A global default format is defined in IO.cpp:
FileFmt DefaultFileFmt = FmtDefault; // FmtDefault = netcdf4c
This global variable is supposed to be updated in IO::init() using the value from omega.yml.
However, in IO::init() a local variable with the same name is declared:
FileFmt DefaultFileFmt = FileFmtFromString(InFileFmt);
This shadows the global variable, so the global DefaultFileFmt is never updated.
Still having errors even after fixing Bug 1 & 2
Once I fixed both issues:
• Things work if defaultfmt = netcdf4c (same as the current hard-coded behavior)
• But, using netcdf4p triggers many errors, including:
- Collective mode not supported with an unlimited time dimension
- Attempts to define variables while in NetCDF data mode
This suggests additional assumptions in the IO layer about NetCDF format semantics.
Observation: Mixed NetCDF formats in Polaris tests
I also noticed multiple NetCDF formats being generated or copied during Polaris testing:
$ ncdump -k output.nc → netCDF-4
$ ncdump -k init.nc → cdf5
$ ncdump -k mesh.nc → netCDF-4
$ ncdump -k OmegaPlanarMesh.nc → 64-bit offset
Given the current IOStream bugs, this mix of formats may not be handled consistently and could be a root cause of the PIO errors.
Suggestion: Standardizing on a single NetCDF format for Polaris tests might significantly reduce current and future IO/PIO issues.
During debugging of a PIO error in the Polaris tests, I identified two potential bugs in the Omega IOStream and IO module that could explain the issue.
Bug 1: Hard-coded NetCDF format ignores
omega.ymlIn
IOStream.cpp, there are two calls like:IO::openFile(InFileID, InFileName, Mode, IO::FmtDefault, ExistAction);IO::FmtDefaultis a compile-time constant defined inIO.h(currentlynetcdf4c).As a result, the NetCDF format specified in
omega.ymlis ignored, and files are always opened asnetcdf4c.Bug 2: Global NetCDF format variable is shadowed
A global default format is defined in
IO.cpp:FileFmt DefaultFileFmt = FmtDefault; // FmtDefault = netcdf4cThis global variable is supposed to be updated in
IO::init()using the value fromomega.yml.However, in
IO::init()a local variable with the same name is declared:FileFmt DefaultFileFmt = FileFmtFromString(InFileFmt);This shadows the global variable, so the global
DefaultFileFmtis never updated.Still having errors even after fixing Bug 1 & 2
Once I fixed both issues:
• Things work if
defaultfmt = netcdf4c(same as the current hard-coded behavior)• But, using
netcdf4ptriggers many errors, including:This suggests additional assumptions in the IO layer about NetCDF format semantics.
Observation: Mixed NetCDF formats in Polaris tests
I also noticed multiple NetCDF formats being generated or copied during Polaris testing:
Given the current IOStream bugs, this mix of formats may not be handled consistently and could be a root cause of the PIO errors.
Suggestion: Standardizing on a single NetCDF format for Polaris tests might significantly reduce current and future IO/PIO issues.