[Hdf-forum] Best Way to Patch HDF5 1.8.17 to compile with nagfor

Thompson, Matt (GSFC-610.1)[SCIENCE SYSTEMS AND APPLICATIONS INC] matthew.thompson at nasa.gov
Tue Aug 16 12:52:29 CDT 2016


All,

I'm wondering if I can get theories on the best way[1] to patch HDF5 
1.8.17 to build with nagfor. Namely, my build is dying when it tries to 
build tf_F03.f90:

> make[4]: Entering directory `/gpfsm/dswdev/mathomp4/Baselibs/TmpBaselibs/GMAO-Baselibs-5_0_2-NAG/src/hdf5/fortran/test'
>   FC       tf_F03.lo
> NAG Fortran Compiler Release 6.0(Hibiya) Build 1064
> Error: tf_F03.f90, line 128: Implicit type for SIZEOF in H5_SIZEOF_DP
> Error: tf_F03.f90, line 128: Implicit type for SIZEOF in H5_SIZEOF_SP
> Error: tf_F03.f90, line 128: Implicit type for SIZEOF in H5_SIZEOF_I
> Error: tf_F03.f90, line 128: Implicit type for SIZEOF in H5_SIZEOF_CHR
> Error: tf_F03.f90, line 128: Implicit type for SIZEOF in H5_SIZEOF_CMPD
> [NAG Fortran Compiler pass 1 error termination, 5 errors]

NAG rightly complains (as NAG is wont to do) that SIZEOF does not exist 
in the Fortran Standard (2003 or otherwise). There is storage_size() in 
F2008 and a colleague suggested:

#ifdef NAGFOR
    integer function sizeof(a)
       class(*), intent(in) :: a
       sizeof = storage_size(a) / 8 ! bits -> bytes
    end function sizeof
#endif

and it allows it to compile.

Would this be my best bet? Or is there a better way that the HDF5 1.10 
transition indicated?

Matt

[1] Note: looking at HDF5 1.10.0-patch1, the "correct" answer is 
probably move to HDF5 1.10 as that seems to have revamped all the 
fortran/test bits. But, I really don't want to have to deal with the 
1.8=>1.10 transition at the moment. My limited testing seems to show it 
might be a non-issue as I use netCDF4 only, but others use these 
libraries to handle pure HDF5 files and I have not tested for side 
effects everywhere. So, for now, I'm dealing with HDF5 1.8.17.


-- 
Matt Thompson, SSAI, Sr Scientific Programmer/Analyst
NASA GSFC,    Global Modeling and Assimilation Office
Code 610.1,  8800 Greenbelt Rd,  Greenbelt,  MD 20771
Phone: 301-614-6712                 Fax: 301-614-6246
http://science.gsfc.nasa.gov/sed/bio/matthew.thompson



More information about the Hdf-forum mailing list