Dear all,
(first of all hello everybody, this is my first message here. I hope it
finds you well). I am trying to run a very basic code. It reads a HDF5
datafile, which contents have been printed by a fortran code and have been
checked with a matlab code. Now i am trying to write my first hdf5 code,
which reads the content of this file. Check these lines out:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
integer(HSIZE_T) :: dim(1),datadims(3)
real*8 :: dbl_vec(2),t,dt
dim=(/2/)
call H5Aopen_f(h5gid,'time_variables',h5attr,h5error)
call H5Aread_f(h5attr,H5T_IEEE_F64BE,dbl_vec(1),dim,h5error)
call H5Aclose_f(h5attr,h5error)
dt=dbl_vec(1)
t=dbl_vec(2)
write(*,*) dt,t
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Before these lines there is code, and it runs fine and i am able to read
integer values from the datafile. If i try to run it, it arrives at the
write instruction and says:
'Illegal Instruction'
and dies with no print.
I am compiling it with h5fc and the HDF5 API version is 1.8.9. The datafile
is around 41MB. Have you ever seen this before?
Thanks in advance,
Marco
There are a few examples at:
http://www.hdfgroup.org/HDF5/examples/api18-fortran.html
which you can start from. Take a look in the “Datatypes” section, particularly at h5ex_t_floatatt_F03.f90
Scot
···
On Mar 28, 2015, at 4:10 AM, Marco Lucchesi <m.lucchesi.1987@gmail.com> wrote:
Dear all,
(first of all hello everybody, this is my first message here. I hope it finds you well). I am trying to run a very basic code. It reads a HDF5 datafile, which contents have been printed by a fortran code and have been checked with a matlab code. Now i am trying to write my first hdf5 code, which reads the content of this file. Check these lines out:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
integer(HSIZE_T) :: dim(1),datadims(3)
real*8 :: dbl_vec(2),t,dt
dim=(/2/)
call H5Aopen_f(h5gid,'time_variables',h5attr,h5error)
call H5Aread_f(h5attr,H5T_IEEE_F64BE,dbl_vec(1),dim,h5error)
call H5Aclose_f(h5attr,h5error)
dt=dbl_vec(1)
t=dbl_vec(2)
write(*,*) dt,t
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Before these lines there is code, and it runs fine and i am able to read integer values from the datafile. If i try to run it, it arrives at the write instruction and says:
'Illegal Instruction'
and dies with no print.
I am compiling it with h5fc and the HDF5 API version is 1.8.9. The datafile is around 41MB. Have you ever seen this before?
Thanks in advance,
Marco
_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5
Hi,
!!!!!!!!!!!
integer(HSIZE_T) :: dim(1),datadims(3)
real*8 :: dbl_vec(2),t,dt
dim=(/2/)
call H5Aopen_f(h5gid,'time_variables',h5attr,h5error)
call H5Aread_f(h5attr,H5T_IEEE_F64BE,dbl_vec(1),dim,h5error)
call H5Aclose_f(h5attr,h5error)
dt=dbl_vec(1)
t=dbl_vec(2)
write(*,*) dt,t
!!!!!!!!!!!
Before these lines there is code, and it runs fine and i am able to
read integer values from the datafile. If i try to run it, it arrives
'Illegal Instruction'
and dies with no print.
It is quite hard to debug this kind of issue remotely. Ideally, you should send
to the list a small program and datafile for which you can reproduce the
problem. In the meantime, here are some possible issues:
1. In the call to H5Aread_f, the datatype is the memory datatype (see
http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-Read )
In your case, this would be H5T_NATIVE_DOUBLE (if using that, you should also
declare the variable as "double precision").
2. Did you compile with the "-g" flag for debugging. It might provide the line
number of the error.
Regards,
Pierre
···
On Sat, Mar 28, 2015 at 10:10:25AM +0100, Marco Lucchesi wrote:
at the write instruction and says:
I am compiling it with h5fc and the HDF5 API version is 1.8.9. The
datafile is around 41MB. Have you ever seen this before?
Thanks in advance,
Marco
The "illegal instruction" message is usually encountered when you are
attempting to run a code on an architecture different than the one that it
was compiled for.
Is the hdf5 library build intended for the machine you are using it on?
···
On Mon, Mar 30, 2015 at 3:13 PM, Pierre de Buyl < pierre.debuyl@chem.kuleuven.be> wrote:
Hi,
On Sat, Mar 28, 2015 at 10:10:25AM +0100, Marco Lucchesi wrote:
> !!!!!!!!!!!
> integer(HSIZE_T) :: dim(1),datadims(3)
> real*8 :: dbl_vec(2),t,dt
> dim=(/2/)
> call H5Aopen_f(h5gid,'time_variables',h5attr,h5error)
> call H5Aread_f(h5attr,H5T_IEEE_F64BE,dbl_vec(1),dim,h5error)
> call H5Aclose_f(h5attr,h5error)
> dt=dbl_vec(1)
> t=dbl_vec(2)
> write(*,*) dt,t
> !!!!!!!!!!!
> Before these lines there is code, and it runs fine and i am able to
> read integer values from the datafile. If i try to run it, it arrives
> at the write instruction and says:
> 'Illegal Instruction'
> and dies with no print.
It is quite hard to debug this kind of issue remotely. Ideally, you should
send
to the list a small program and datafile for which you can reproduce the
problem. In the meantime, here are some possible issues:
1. In the call to H5Aread_f, the datatype is the memory datatype (see
http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-Read )
In your case, this would be H5T_NATIVE_DOUBLE (if using that, you should
also
declare the variable as "double precision").
2. Did you compile with the "-g" flag for debugging. It might provide the
line
number of the error.
Regards,
Pierre
> I am compiling it with h5fc and the HDF5 API version is 1.8.9. The
> datafile is around 41MB. Have you ever seen this before?
> Thanks in advance,
> Marco
_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5
--
Jim Edwards
CESM Software Engineer
National Center for Atmospheric Research
Boulder, CO