···
--
Mike Jackson:
Michael Jackson wrote:
I have been trying to figure out an error that we are getting using the
HDF5 library for a fairly simple program. The original error started out
in our project but we have been able to narrow it down to this sample.
Here is the setup:
Windows 10 x64, Intel Fortran v17.20160721, Visual Studio 2013 SP5,
CMake 3.5.1 and NMake files
We have built HDF5 1.8.15 with STATIC libraries, High Level, CPP and
FORTRAN interfaces.
Both our code and HDF5 were built as Debug in one folder and Release in
another. Neither version will execute correctly.
We then try to use CMake (not sure if this matters at all) to compile
and run a simple program using pure HDF5 calls (versus some higher level
functions that we had written earlier). When we execute the program we
get the following runtime error:
forrtl: severe (170): Program Exception - stack overflow
and then a stack trace but the stack does not show anything except a
bunch of "unknown" files and line numbers.
The code will be included below. The same code also had issues on OS X
when we linked against an intermediate dynamic library but we fixed that
issue. This makes me think that maybe we are mixing libraries maybe?
Debug and Release?
Has anyone else had issues with the Intel Fortran compiler on Windows
and HDF5? We can not use GFORTRAN because there isn't a new enough
version available for Windows (we need GFortran 5.2 or newer).
--
Michael A. Jackson 400 S. Pioneer Blvd
!*****************************************************************************************
program jsontest
!! this is a test program for HDF5 commands without any reference to EMsoftLib.
use ISO_C_BINDING
use hdf5
IMPLICIT NONE
character(len=1),target :: chararr2(256,256)
integer*4,target :: iarr(256,256,256)
integer*4 :: i1, i2, i3, dim0, dim1, dim3, hdferr, rnk
integer(HID_T) :: file_id, group_id
integer(HID_T) :: space, dset
integer(HSIZE_T), DIMENSION(1:2) :: dims
integer(HSIZE_T), DIMENSION(1:3) :: dims3
character(len=8) :: dataset1
TYPE(C_PTR), dimension(1:256,1:256), TARGET :: wdata
TYPE(C_PTR), dimension(1:256,1:256,1:256), TARGET :: wdata3
TYPE(C_PTR) :: f_ptr
character(len=132) :: outname, groupname, nmlname, dataset
!==================================
! Initialize FORTRAN interface.
write(*,"('opening HDF-fortran interface ')")
call h5open_f(hdferr)
!==================================
!==================================
! Create a new file using the default properties.
outname ='Test.h5'
write(*,"('creating file ',$)")
call h5fcreate_f(trim(outname), H5F_ACC_TRUNC_F, file_id, hdferr)
write(*,*) trim(outname), file_id
if (hdferr.ne.0) then
write(*,*) 'HDF_createFile: error creating file; error code = ',hdferr
STOP
end if
!==================================
!==================================
! create the TestData group
groupname ='TestData'
write(*,"('creating group ',$)")
call H5Gcreate_f(file_id, groupname, group_id, hdferr)
write(*,*) trim(groupname), group_id
!==================================
!==================================
! generate a 3D integer array and write it to the file
do i1=1,256
do i2=1,256
do i3=1,256
iarr(i1,i2,i3) = i1+i2+i3
end do
end do
end do
dataset = 'intarr3D'
dim0 = 256
dims3(1:3) = (/ dim0, dim0, dim0 /)
wdata3 = C_LOC(iarr(1,1,1))
! Create dataspace.
rnk = 3
write (*,*) ' intarr3: h5screate_simple_f'
call h5screate_simple_f(rnk, dims3, space, hdferr)
!
! Create the dataset and write the data to it
write (*,*) ' intarr3: h5screate_f ',H5T_STD_I32LE, H5T_NATIVE_INTEGER
dataset1 = 'intarr3D'
call h5dcreate_f(group_id, dataset1, H5T_STD_I32LE, space, dset, hdferr)
if (hdferr.ne.0) then
write(*,*) 'h5dcreate_f: error creating int3D dataset; error code = ',hdferr
STOP
end if
write (*,*) ' intarr3: h5dwrite_f'
call h5dwrite_f(dset, H5T_STD_I32LE, iarr, dims3, hdferr )
if (hdferr.ne.0) then
write(*,*) 'h5dwrite_f: error writing int3D dataset; error code = ',hdferr
STOP
end if
!
! Close and release resources.
!
call h5dclose_f(dset , hdferr)
call h5sclose_f(space, hdferr)
!==================================
!==================================
! generate a 2D char array and write it to the file
do i1=1,256
do i2=1,256
chararr2(i1,i2) = char(mod(i1+i2-2,256))
end do
end do
dataset = 'chararray2D'
dim0 = 256
wdata = C_LOC(chararr2(1,1))
dims(1:2) = (/ dim0, dim0 /)
! Create dataspace.
rnk = 2
write (*,*) ' chararr2: h5screate_simple_f'
call h5screate_simple_f(rnk, dims, space, hdferr)
!
! Create the dataset and write the c_char data to it.
write (*,*) ' chararr2: h5dcreate_f '
call h5dcreate_f(group_id, trim(dataset), H5T_STD_U8LE, space, dset, hdferr)
if (hdferr.ne.0) then
write(*,*) 'h5dcreate_f: error creating char2D dataset; error code = ',hdferr
STOP
end if
write (*,*) ' chararr2: h5dwrite_f'
call h5dwrite_f(dset, H5T_STD_U8LE, chararr2, dims, hdferr )
if (hdferr.ne.0) then
write(*,*) 'h5dwrite_f: error writing char2D dataset; error code = ',hdferr
STOP
end if
!
! Close and release resources.
!
call h5dclose_f(dset , hdferr)
call h5sclose_f(space, hdferr)
!==================================
!==================================
! close group and file
call h5gclose_f(group_id, hdferr)
call h5fclose_f(file_id, hdferr)
! and close the fortran hdf interface
call h5close_f(hdferr)
end program jsontest
!*****************************************************************************************