how to write integer*8 fortran data to an hdf5 file?

Hi,

I am a relatively new user of hdf5. I am unsuccessfully trying to write integer*8 data to an hdf5 file

Here is part of my code :
  
        integer, allocatable :: code(:slight_smile:
              integer*8, allocatable :: delay(:slight_smile:

  ……

        call h5screate_simple_f(1,dset_dims,dspace_id,error)
              call h5dcreate_f(sub_group_id,"Code",H5T_NATIVE_INTEGER,dspace_id,dset_id,error)
              call h5dwrite_f(dset_id,H5T_NATIVE_INTEGER,code,dset_dims,error)
              call h5dclose_f(dset_id,error)
              call h5sclose_f(dspace_id,error)
              call h5screate_simple_f(1,dset_dims,dspace_id,error)
              call h5dcreate_f(sub_group_id,"Delay",H5T_STD_U16BE,dspace_id,dset_id,error)
              call h5dwrite_f(dset_id,H5T_STD_U16BE,delay,dset_dims,error)
              call h5dclose_f(dset_id,error)
              call h5sclose_f(dspace_id,error)

And the compilation fails with the following error using gfortran :

  call h5dwrite_f(dset_id,H5T_STD_U16BE,delay,dset_dims,error)
                                                                          1
Error: There is no specific subroutine for the generic 'h5dwrite_f' at (1)

I works fine with the native types, but I can't make it run with integer*8, is there a workaround?

Thanks,

Thomas

Hi,

You have to build the hdf5 library so that the default integer is *8 (for example, use the compiler flag -i8 for the Intel compiler, other compilers have similar flags). If you've built the hdf5 library with F2003 features enabled (--enable-fortran --enable-fortran2003) then you can take a look at rwdset_fortran2003.f90 in the hdf5 source (fortran/examples directory) for using F2003 to write the data.

Scot

···

On 2012-05-15 08:13, Thomas Unfer wrote:

Hi,

I am a relatively new user of hdf5. I am unsuccessfully trying to
write integer*8 data to an hdf5 file

Here is part of my code :

        integer, allocatable :: code(:slight_smile:
              integer*8, allocatable :: delay(:slight_smile:

  ……

        call h5screate_simple_f(1,dset_dims,dspace_id,error)
              call

h5dcreate_f(sub_group_id,"Code",H5T_NATIVE_INTEGER,dspace_id,dset_id,error)
              call
h5dwrite_f(dset_id,H5T_NATIVE_INTEGER,code,dset_dims,error)
              call h5dclose_f(dset_id,error)
              call h5sclose_f(dspace_id,error)
              call h5screate_simple_f(1,dset_dims,dspace_id,error)
              call

h5dcreate_f(sub_group_id,"Delay",H5T_STD_U16BE,dspace_id,dset_id,error)
              call h5dwrite_f(dset_id,H5T_STD_U16BE,delay,dset_dims,error)
              call h5dclose_f(dset_id,error)
              call h5sclose_f(dspace_id,error)

And the compilation fails with the following error using gfortran :

  call h5dwrite_f(dset_id,H5T_STD_U16BE,delay,dset_dims,error)
                                                                         1
Error: There is no specific subroutine for the generic 'h5dwrite_f' at (1)

I works fine with the native types, but I can't make it run with
integer*8, is there a workaround?

Thanks,

Thomas
_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Hi,

that seems ok, but what if i want to write/read integer*4 and integer*8?

thanks,

Thomas

···

Le 15 mai 2012 à 15:38, brtnfld@hdfgroup.org a écrit :

Hi,

You have to build the hdf5 library so that the default integer is *8 (for example, use the compiler flag -i8 for the Intel compiler, other compilers have similar flags). If you've built the hdf5 library with F2003 features enabled (--enable-fortran --enable-fortran2003) then you can take a look at rwdset_fortran2003.f90 in the hdf5 source (fortran/examples directory) for using F2003 to write the data.

Scot

On 2012-05-15 08:13, Thomas Unfer wrote:

Hi,

I am a relatively new user of hdf5. I am unsuccessfully trying to
write integer*8 data to an hdf5 file

Here is part of my code :

        integer, allocatable :: code(:slight_smile:
             integer*8, allocatable :: delay(:slight_smile:

  ……

        call h5screate_simple_f(1,dset_dims,dspace_id,error)
             call
h5dcreate_f(sub_group_id,"Code",H5T_NATIVE_INTEGER,dspace_id,dset_id,error)
             call
h5dwrite_f(dset_id,H5T_NATIVE_INTEGER,code,dset_dims,error)
             call h5dclose_f(dset_id,error)
             call h5sclose_f(dspace_id,error)
             call h5screate_simple_f(1,dset_dims,dspace_id,error)
             call
h5dcreate_f(sub_group_id,"Delay",H5T_STD_U16BE,dspace_id,dset_id,error)
             call h5dwrite_f(dset_id,H5T_STD_U16BE,delay,dset_dims,error)
             call h5dclose_f(dset_id,error)
             call h5sclose_f(dspace_id,error)

And the compilation fails with the following error using gfortran :

  call h5dwrite_f(dset_id,H5T_STD_U16BE,delay,dset_dims,error)
                                                                        1
Error: There is no specific subroutine for the generic 'h5dwrite_f' at (1)

I works fine with the native types, but I can't make it run with
integer*8, is there a workaround?

Thanks,

Thomas
_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

To specify Fortran integer*8 i guess you can use:
H5T_FORTRAN_I64

or something like that.

Check this :
http://www.hdfgroup.org/HDF5/doc/UG/11_Datatypes.html

Mathieu

Quoting Thomas Unfer <thomas.unfer@imft.fr>:

···

Hi,

that seems ok, but what if i want to write/read integer*4 and integer*8?

thanks,

Thomas

Le 15 mai 2012 à 15:38, brtnfld@hdfgroup.org a écrit :

Hi,

You have to build the hdf5 library so that the default integer is *8 (for example, use the compiler flag -i8 for the Intel compiler, other compilers have similar flags). If you've built the hdf5 library with F2003 features enabled (--enable-fortran --enable-fortran2003) then you can take a look at rwdset_fortran2003.f90 in the hdf5 source (fortran/examples directory) for using F2003 to write the data.

Scot

On 2012-05-15 08:13, Thomas Unfer wrote:

Hi,

I am a relatively new user of hdf5. I am unsuccessfully trying to
write integer*8 data to an hdf5 file

Here is part of my code :

        integer, allocatable :: code(:slight_smile:
             integer*8, allocatable :: delay(:slight_smile:

        call h5screate_simple_f(1,dset_dims,dspace_id,error)
             call
h5dcreate_f(sub_group_id,"Code",H5T_NATIVE_INTEGER,dspace_id,dset_id,error)
             call
h5dwrite_f(dset_id,H5T_NATIVE_INTEGER,code,dset_dims,error)
             call h5dclose_f(dset_id,error)
             call h5sclose_f(dspace_id,error)
             call h5screate_simple_f(1,dset_dims,dspace_id,error)
             call
h5dcreate_f(sub_group_id,"Delay",H5T_STD_U16BE,dspace_id,dset_id,error)
             call h5dwrite_f(dset_id,H5T_STD_U16BE,delay,dset_dims,error)
             call h5dclose_f(dset_id,error)
             call h5sclose_f(dspace_id,error)

And the compilation fails with the following error using gfortran :

  call h5dwrite_f(dset_id,H5T_STD_U16BE,delay,dset_dims,error)
                                                                        1
Error: There is no specific subroutine for the generic 'h5dwrite_f' at (1)

I works fine with the native types, but I can't make it run with
integer*8, is there a workaround?

Thanks,

Thomas
_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Hi,

that seems ok, but what if i want to write/read integer*4 and integer*8?

thanks,

Thomas

Hi,
you can find the description of new features along with the examples how
to write any integer kind here[1].
Cheers,
Kacper

[1] http://www.hdfgroup.org/HDF5/doc/fortran/NewFeatures_F2003.pdf

···

On 15.05.2012 15:46, Thomas Unfer wrote:

Le 15 mai 2012 à 15:38, brtnfld@hdfgroup.org a écrit :

Hi,

You have to build the hdf5 library so that the default integer is *8 (for example, use the compiler flag -i8 for the Intel compiler, other compilers have similar flags). If you've built the hdf5 library with F2003 features enabled (--enable-fortran --enable-fortran2003) then you can take a look at rwdset_fortran2003.f90 in the hdf5 source (fortran/examples directory) for using F2003 to write the data.

Scot

On 2012-05-15 08:13, Thomas Unfer wrote:

Hi,

I am a relatively new user of hdf5. I am unsuccessfully trying to
write integer*8 data to an hdf5 file

Here is part of my code :

        integer, allocatable :: code(:slight_smile:
             integer*8, allocatable :: delay(:slight_smile:

  ……

        call h5screate_simple_f(1,dset_dims,dspace_id,error)
             call
h5dcreate_f(sub_group_id,"Code",H5T_NATIVE_INTEGER,dspace_id,dset_id,error)
             call
h5dwrite_f(dset_id,H5T_NATIVE_INTEGER,code,dset_dims,error)
             call h5dclose_f(dset_id,error)
             call h5sclose_f(dspace_id,error)
             call h5screate_simple_f(1,dset_dims,dspace_id,error)
             call
h5dcreate_f(sub_group_id,"Delay",H5T_STD_U16BE,dspace_id,dset_id,error)
             call h5dwrite_f(dset_id,H5T_STD_U16BE,delay,dset_dims,error)
             call h5dclose_f(dset_id,error)
             call h5sclose_f(dspace_id,error)

And the compilation fails with the following error using gfortran :

  call h5dwrite_f(dset_id,H5T_STD_U16BE,delay,dset_dims,error)
                                                                        1
Error: There is no specific subroutine for the generic 'h5dwrite_f' at (1)

I works fine with the native types, but I can't make it run with
integer*8, is there a workaround?

Thanks,

Thomas
_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org