[petsc-dev] need for HDF5 < 1.8.0 support?

Hapla Vaclav vaclav.hapla at erdw.ethz.ch
Fri Dec 7 03:35:15 CST 2018


I wanted to add support for HDF5 attributes of groups (currently only datasets).

But I already feel like held back by supporting HDF5 older than 1.8.0. Do we still need that?

My arguments to get rid of that support:
1) It seems we already use some 1.8.0+ functions anyway (might be my fault, though).
2) We could get rid of all those #if
3) There were quite some useful API functions introduced in that release which would make the code simpler. For instance, H5O* functions allow handling groups and datasets the same way.

Ad 2,3 consider this

/* OLD */
#if (H5_VERS_MAJOR * 10000 + H5_VERS_MINOR * 100 + H5_VERS_RELEASE >= 10800)
  if (dataset) {
    PetscStackCallHDF5Return(object, H5Dopen2, (h5, parent, H5P_DEFAULT));
  } else if (type == H5O_TYPE_GROUP) {
    PetscStackCallHDF5Return(object, H5Gopen2, (h5, parent, H5P_DEFAULT));
  }
#else
  if (dataset) {
    PetscStackCallHDF5Return(object, H5Dopen, (h5, parent));
  } else if (type == H5O_TYPE_GROUP) {
    PetscStackCallHDF5Return(object, H5Gopen, (h5, parent));
  }
#endif
...
  if (dataset) {
    PetscStackCallHDF5Return(err, H5Dclose, (object));
  } else if (type == H5O_TYPE_GROUP) {
    PetscStackCallHDF5Return(err, H5Gclose, (object));
  }


/* NEW */
  PetscStackCallHDF5Return(object, H5Oopen, (h5, parent, H5P_DEFAULT));
  ...
  PetscStackCallHDF5Return(err, H5Oclose, (object));


Additionally, function H5Oget_info() which can say whether the object is group or dataset was also introduced only in 1.8.0. So the dataset flag above would have to be set by a user it seems...

So I personally think it's already about time to leave the old HDF5 API behind... Objections? If no, I would make a PR which would clean the code from the #ifs and forbid the older versions already in configure.

Vaclav


More information about the petsc-dev mailing list