Commit ff338b08 authored by Philip Carns's avatar Philip Carns

runtime safety check for HDF5 library version

- untested
parent 0b434339
......@@ -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
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment