[Darshan-commits] [Git][darshan/darshan][issue-217-hdf5-abi-switch] runtime safety check for HDF5 library version
Philip Carns
xgitlab at cels.anl.gov
Wed Jan 25 22:19:06 CST 2017
Philip Carns pushed to branch issue-217-hdf5-abi-switch at darshan / darshan
Commits:
ff338b08 by Phil Carns at 2017-01-25T20:18:36-08:00
runtime safety check for HDF5 library version
- untested
- - - - -
2 changed files:
- darshan-runtime/lib/darshan-hdf5-stubs.c
- darshan-runtime/lib/darshan-hdf5.c
Changes:
=====================================
darshan-runtime/lib/darshan-hdf5-stubs.c
=====================================
--- a/darshan-runtime/lib/darshan-hdf5-stubs.c
+++ b/darshan-runtime/lib/darshan-hdf5-stubs.c
@@ -70,6 +70,21 @@ herr_t H5Fclose(hid_t file_id)
return(-1);
}
+herr_t H5get_libversion(unsigned *majnum, unsigned *minnum, unsigned *relnum) __attribute__((weak));
+
+herr_t H5get_libversion(unsigned *majnum, unsigned *minnum, unsigned *relnum)
+{
+ int rank;
+
+ MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+ if(rank == 0)
+ {
+ fprintf(stderr, "WARNING: Darshan H5get_libversion() stub called; this is probably the result of a link-time problem.\n");
+ }
+
+ return(-1);
+}
+
/*
* Local variables:
* c-indent-level: 4
=====================================
darshan-runtime/lib/darshan-hdf5.c
=====================================
--- a/darshan-runtime/lib/darshan-hdf5.c
+++ b/darshan-runtime/lib/darshan-hdf5.c
@@ -36,6 +36,7 @@ typedef int herr_t; //hf5-1.10.0p1: H5public.h:126
DARSHAN_FORWARD_DECL(H5Fcreate, hid_t, (const char *filename, unsigned flags, hid_t create_plist, hid_t access_plist));
DARSHAN_FORWARD_DECL(H5Fopen, hid_t, (const char *filename, unsigned flags, hid_t access_plist));
DARSHAN_FORWARD_DECL(H5Fclose, herr_t, (hid_t file_id));
+DARSHAN_FORWARD_DECL(H5get_libversion, herr_t, (unsigned *majnum, unsigned *minnum, unsigned *relnum));
/* structure that can track i/o stats for a given HDF5 file record at runtime */
struct hdf5_file_record_ref
@@ -120,6 +121,22 @@ hid_t DARSHAN_DECL(H5Fcreate)(const char *filename, unsigned flags,
hid_t ret;
char* tmp;
double tm1;
+ unsigned majnum, minnum, relnum;
+
+ MAP_OR_FAIL(H5get_libversion);
+ __real_H5get_libversion(&majnum, &minnum, &relnum);
+#ifdef __DARSHAN_ENABLE_HDF5110
+ if((ret < 0) || (majnum < 1 || (majnum == 1 && minnum < 10)))
+#else
+ if((ret < 0) || (majnum > 1 || (majnum == 1 && minnum >= 10)))
+#endif
+ {
+ if(my_rank == 0)
+ {
+ fprintf(stderr, "Darshan HDF5 module error: runtime library version does not match Darshan module.\n");
+ }
+ return(-1);
+ }
MAP_OR_FAIL(H5Fcreate);
@@ -151,6 +168,22 @@ hid_t DARSHAN_DECL(H5Fopen)(const char *filename, unsigned flags,
hid_t ret;
char* tmp;
double tm1;
+ unsigned majnum, minnum, relnum;
+
+ MAP_OR_FAIL(H5get_libversion);
+ __real_H5get_libversion(&majnum, &minnum, &relnum);
+#ifdef __DARSHAN_ENABLE_HDF5110
+ if((ret < 0) || (majnum < 1 || (majnum == 1 && minnum < 10)))
+#else
+ if((ret < 0) || (majnum > 1 || (majnum == 1 && minnum >= 10)))
+#endif
+ {
+ if(my_rank == 0)
+ {
+ fprintf(stderr, "Darshan HDF5 module error: runtime library version does not match Darshan module.\n");
+ }
+ return(-1);
+ }
MAP_OR_FAIL(H5Fopen);
View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/commit/ff338b089e340ab44d8dd1c8f50c6133482bdca9
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/darshan-commits/attachments/20170125/c7ae9ea6/attachment-0001.html>
More information about the Darshan-commits
mailing list