[hdf-forum] fortran problem with "h5ltget_dataset_info_f"

Pedro Vicente pvn at hdfgroup.org
Fri Mar 27 11:14:34 EDT 2009


Cyril 

that bug has been fixed

we provide snapshots between releases. To get them, please go to

http://www.hdfgroup.org/HDF5/

then click on "snapshots" at the very end, or direct link

ftp://ftp.hdfgroup.uiuc.edu/pub/outgoing/hdf5/snapshots/

you can either choose v18 or v19 (this is the development branch)

these snapshots are automatically made every weekend, so this latest fix is *not* yet there, but it should be this weekend (check the file date)

I added an example of use of the function to the Fortran Lite test program, in

/hdf5/hl/fortran/test/tstlite.f90

the documentation is also available at

http://www.hdfgroup.org/HDF5/doc/HL/RM_H5LT.html

let us know if you have any problems getting the snapshot or using the function

Pedro


At 10:15 AM 3/19/2009, cyril giraudon wrote:
>Hi,
>
>I try to use the function "h5ltget_dataset_info_f" of the Lite API and
>it doesn't work.
>Unfortunatly, there is no example of this function in the hl/test directory.
>
>I use GNU Fortran 95 (GCC) 4.1.1 20060724 (prerelease)
>(4.1.1-3.1mdv2007.0) on Linux.
>
>The signature of  h5ltget_dataset_info_f is
> - file id,
>- dataset name,
>- dataset dims,
>- type class,
>- type size,
>- hdferr
>
>The HDF5 file contains only a "/nodes" dataset of 15x3 real
>dims is a (1 rank, dimension 2)  array of integers.
>
>With a static dims array (integer, dimension(2) :: dims), file_id seems
>corrupted since HDF5 can't close the file correctly and the error output
>is :
>""""
>HDF5-DIAG: Error detected in HDF5 (1.8.2) thread 0:
>  #000: H5F.c line 2085 in H5Fclose(): not a file ID
>    major: Invalid arguments to routine
>    minor: Inappropriate type
> h5fclose_f KO
>make: *** [test_get_dataset_info] Erreur 4
>""""
>
>if dims is dynamic (integer, dimension(:), allocatable :: dims;
>allocate(dims(2)),
>the program crashes :
>""""
>        Dims :                   15                    3
>*** glibc detected *** ./get_dataset_info: free(): invalid next size
>(fast): 0x08071f78 ***
>======= Backtrace: =========
>/lib/i686/libc.so.6[0x40618d9d]
>/lib/i686/libc.so.6(__libc_free+0x83)[0x40618f23]
>/usr/lib/libgfortran.so.1(_gfortran_deallocate+0x32)[0x40516f82]
>./get_dataset_info[0x8048e3e]
>./get_dataset_info[0x8048f17]
>/lib/i686/libc.so.6(__libc_start_main+0xdc)[0x405c975c]
>./get_dataset_info[0x8048a81]
>======= Memory map: ========
>08048000-0804a000 r-xp 00000000 08:06 9385383   
>/home/cyril/affaires/quercy_toolkit/hdf5_amelet/fortran_language/macro/get_dataset_info
>0804a000-0804b000 rwxp 00001000 08:06 9385383   
>/home/cyril/affaires/quercy_toolkit/hdf5_amelet/fortran_language/macro/get_dataset_info
>0804b000-0808d000 rwxp 0804b000 00:00 0          [heap]
>40000000-40018000 r-xp 00000000 08:01 939023     /lib/ld-2.4.so
>40018000-40019000 r-xp 00017000 08:01 939023     /lib/ld-2.4.so
>40019000-4001a000 rwxp 00018000 08:01 939023     /lib/ld-2.4.so
>4001a000-4001b000 rwxp 4001a000 00:00 0
>4001b000-4004d000 r-xp 00000000 08:06 8462742   
>/home/cyril/affaires/quercy_toolkit/hdf5_amelet/macrocompat_local/lib/libhdf5_fortran.so.0.0.0
>4004d000-4004f000 rwxp 00031000 08:06 8462742   
>/home/cyril/affaires/quercy_toolkit/hdf5_amelet/macrocompat_local/lib/libhdf5_fortran.so.0.0.0
>4004f000-40488000 r-xp 00000000 08:06 8462732   
>/home/cyril/affaires/quercy_toolkit/hdf5_amelet/macrocompat_local/lib/libhdf5.so.6.0.1
>40488000-4048d000 rwxp 00439000 08:06 8462732   
>/home/cyril/affaires/quercy_toolkit/hdf5_amelet/macrocompat_local/lib/libhdf5.so.6.0.1
>4048d000-4048e000 rwxp 4048d000 00:00 0
>4048e000-4049a000 r-xp 00000000 08:06 8462757   
>/home/cyril/affaires/quercy_toolkit/hdf5_amelet/macrocompat_local/lib/libhdf5hl_fortran.so.0.0.0
>4049a000-4049b000 rwxp 0000c000 08:06 8462757   
>/home/cyril/affaires/quercy_toolkit/hdf5_amelet/macrocompat_local/lib/libhdf5hl_fortran.so.0.0.0
>4049b000-404b9000 r-xp 00000000 08:06 8462747   
>/home/cyril/affaires/quercy_toolkit/hdf5_amelet/macrocompat_local/lib/libhdf5_hl.so.0.0.0
>404b9000-404ba000 rwxp 0001e000 08:06 8462747   
>/home/cyril/affaires/quercy_toolkit/hdf5_amelet/macrocompat_local/lib/libhdf5_hl.so.0.0.0
>404ba000-404cc000 rwxp 404ba000 00:00 0
>404cc000-404ee000 r-xp 00000000 08:06 8462762   
>/home/cyril/affaires/quercy_toolkit/hdf5_amelet/macrocompat_local/lib/libmed.so.1.0.1
>404ee000-404ef000 rwxp 00021000 08:06 8462762   
>/home/cyril/affaires/quercy_toolkit/hdf5_amelet/macrocompat_local/lib/libmed.so.1.0.1
>4050b000-40583000 r-xp 00000000 08:01 194225    
>/usr/lib/libgfortran.so.1.0.0
>40583000-40584000 rwxp 00078000 08:01 194225    
>/usr/lib/libgfortran.so.1.0.0
>40584000-405a7000 r-xp 00000000 08:01 939015     /lib/i686/libm-2.4.so
>405a7000-405a9000 rwxp 00023000 08:01 939015     /lib/i686/libm-2.4.so
>405a9000-405b3000 r-xp 00000000 08:01 951749     /lib/libgcc_s-4.1.1.so.1
>405b3000-405b4000 rwxp 0000a000 08:01 951749     /lib/libgcc_s-4.1.1.so.1
>405b4000-406db000 r-xp 00000000 08:01 939458     /lib/i686/libc-2.4.so
>406db000-406dc000 r-xp 00126000 08:01 939458     /lib/i686/libc-2.4.so
>406dc000-406de000 rwxp 00127000 08:01 939458     /lib/i686/libc-2.4.so
>406de000-406e1000 rwxp 406de000 00:00 0
>406e1000-406f3000 r-xp 00000000 08:01 939064     /lib/libz.so.1.2.3
>406f3000-406f4000 rwxp 00011000 08:01 939064     /lib/libz.so.1.2.3
>406f4000-406f5000 rwxp 406f4000 00:00 0
>406f5000-40712000 r-xp 00000000 08:01 195607     /usr/lib/libg2c.so.0.0.0
>40712000-40713000 rwxp 0001c000 08:01 195607     /usr/lib/libg2c.so.0.0.0
>40713000-40758000 rwxp 40713000 00:00 0
>40800000-40821000 rwxp 40800000 00:00 0
>40821000-40900000 ---p 40821000 00:00 0
>bfc35000-bfc4a000 rw-p bfc35000 00:00 0          [stack]
>bfffe000-bffff000 r-xp bfffe000 00:00 0
>make: *** [test_get_dataset_info] Abandon (vidange mémoire)
>"""
>
>
>Is there any known problems with this function ?
>
>Thanks a lot,
>
>Cyril.
>
>
>
>
>
>
>Below is the fortran 90 program produces such results.
>
>##############################
>program get_dataset_info
>
>! General hdf5 module
>use hdf5
>! API Lite module
>use h5lt
>! Table manipulation module
>use h5tb
>! Group manapulation module
>use h5g
>
>implicit none
>
>integer :: hdferr
>character(len=*), parameter :: filename = "mesh.h5"
>integer(hid_t) :: file_id
>integer :: type_class
>integer(size_t) :: type_size
>
>integer(hsize_t), dimension(:), allocatable :: dyn_dims
>integer(hsize_t), dimension(2) :: stat_dims
>
>
>! Library initialization (native types handling)
>call h5open_f(hdferr)
>if (hdferr < 0) then
>    print *, "h5open_f KO"
>    call exit(1)
>end if
>
>! Open the file in read only mode
>call h5fopen_f(filename, H5F_ACC_RDONLY_F, file_id, hdferr, H5P_DEFAULT_F)
>if (hdferr < 0) then
>    print *, "h5fopen_f KO"
>    call exit(2)
>end if
>
>
>! Read stat_dims
>stat_dims = 0
>call h5ltget_dataset_info_f(file_id, "nodes", stat_dims, &
>                            type_class, type_size, hdferr)
>if (hdferr < 0) then
>    print *, "h5ltget_dataset_info_f ko"
>    call exit(3)
>end if
>! print *, "\tstatic dims :", stat_dims
>
>
>! Read dyn_dims
>!allocate(dyn_dims(2))
>!dyn_dims = 0
>!call h5ltget_dataset_info_f(file_id, "nodes", dyn_dims, &
>!                            type_class, type_size, hdferr)
>! if (hdferr < 0) then
>!     print *, "h5ltget_dataset_info_f ko"
>!     call exit(3)
>! end if
>!print *, "\tDims :", dyn_dims
>!deallocate(dyn_dims)
>
>
>! Close the file
>call h5fclose_f(file_id, hdferr)
>if (hdferr < 0) then
>    print *, "h5fclose_f KO"
>    call exit(4)
>end if
>
>end program get_dataset_info
>
>
>----------------------------------------------------------------------
>This mailing list is for HDF software users discussion.
>To subscribe to this list, send a message to hdf-forum-subscribe at hdfgroup.org.
>To unsubscribe, send a message to hdf-forum-unsubscribe at hdfgroup.org.

 
--------------------------------------------------------------
Pedro Vicente (T) 217.265-0311
pvn at hdfgroup.org
The HDF Group. 1901 S. First. Champaign, IL 61820



----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe at hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe at hdfgroup.org.





More information about the Hdf-forum mailing list