From: James Van Buskirk on 1 Dec 2009 20:55 "Steve Lionel" <steve.lionel(a)intel.invalid> wrote in message news:7nlv68F3lc1jtU1(a)mid.individual.net... > There's an interesting thing here. Compare the call that Ralph says he > used with the one displayed in the error message - they are quite > different. If I had to guess (and I do), I'd say that My and Nx are not > default integer. I am cheering for dset_id to be undeclared and not a TKR match for dset1_id. -- write(*,*) transfer((/17.392111325966148d0,6.5794487871554595D-85, & 6.0134700243160014d-154/),(/'x'/)); end
From: Richard Maine on 1 Dec 2009 23:04 Steve Lionel <steve.lionel(a)intel.invalid> wrote: > There's an interesting thing here. Compare the call that Ralph says he > used with the one displayed in the error message - they are quite > different. Excellent point. I missed that. Makes me even more want to see an actual complete sample, since the tidbits reported seem internally inconsistent. I'm inclined to guess this is yet another case of telling us what he thought was wrong instead of showing the original data. -- Richard Maine | Good judgment comes from experience; email: last name at domain . net | experience comes from bad judgment. domain: summertriangle | -- Mark Twain
From: Ralph Kube on 2 Dec 2009 04:16 Hi Richard, here is the complete data. It is a modified example program from the HDF5 software. When i exchange the call in line 81 CALL h5dread_f(dset1_id, H5T_NATIVE_DOUBLE, bufnew, data_dims, error) with CALL h5dread_f(dset1_id, H5T_NATIVE_DOUBLE, bufnew, (/64,64/), error) i get a compiler error: selectele2.f90(81): error #6285: There is no matching specific subroutine for this generic subroutine call. [H5DREAD_F] CALL h5dread_f(dset1_id, H5T_NATIVE_DOUBLE, bufnew, (/64,64/), error) -----------^ compilation aborted for selectele2.f90 (code 1) To better understand how Fortran works I am curious to find out what the reason for this behaviour is. Cheers, Ralph ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! Copyright by The HDF Group. * ! Copyright by the Board of Trustees of the University of Illinois. * ! All rights reserved. * ! * ! This file is part of HDF5. The full HDF5 copyright notice, including * ! terms governing use, modification, and redistribution, is contained in * ! the files COPYING and Copyright.html. COPYING can be found at the root * ! of the source code distribution tree; Copyright.html can be found at the * ! root level of an installed copy of the electronic HDF5 document set and * ! is linked from the top-level documents page. It can also be found at * ! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * ! access to either file, you may request a copy from help(a)hdfgroup.org. * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! ! ! This program creates two files, copy1.h5, and copy2.h5. ! In copy1.h5, it creates a 3x4 dataset called 'Copy1', ! and write 0's to this dataset. ! In copy2.h5, it create a 3x4 dataset called 'Copy2', ! and write 1's to this dataset. ! It closes both files, reopens both files, selects two ! points in copy1.h5 and writes values to them. Then it ! uses an H5Scopy to write the same selection to copy2.h5. ! Program reopens the files, and reads and prints the contents of ! the two datasets. ! PROGRAM SELECTEXAMPLE USE HDF5 ! This module contains all necessary modules IMPLICIT NONE CHARACTER(LEN=11), PARAMETER :: filename1 = "output.hdf5" ! File name CHARACTER(LEN=5), PARAMETER :: dsetname1 = "O/002" ! Dataset name CHARACTER(LEN=20) :: name_buffer INTEGER, PARAMETER :: RANK = 2 ! Dataset rank INTEGER(SIZE_T), PARAMETER :: NUMP = 2 ! Number of points selected INTEGER(HID_T) :: file1_id ! File1 identifier INTEGER(HID_T) :: dset1_id ! Dataset1 identifier INTEGER(HID_T) :: dataspace1 ! Dataspace identifier INTEGER(HID_T) :: memspace ! memspace identifier INTEGER(HSIZE_T), DIMENSION(1) :: dimsm = (/2/) ! Memory dataspace dimensions INTEGER(HSIZE_T), DIMENSION(2) :: dimsf = (/64,64/) ! File dataspace dimensions INTEGER(HSIZE_T), DIMENSION(RANK,NUMP) :: coord ! Elements coordinates ! in the file real(kind=8), DIMENSION(64,64) :: bufnew ! Data buffers INTEGER, DIMENSION(2) :: val = (/53, 59/) ! Values to write INTEGER :: memrank = 1 ! Rank of the dataset in memory INTEGER :: i, j INTEGER :: error ! Error flag INTEGER :: nmembers, htype LOGICAL :: status INTEGER(HSIZE_T), DIMENSION(2) :: data_dims CALL h5open_f(error) ! Open the files. print*, filename1 CALL h5fopen_f (filename1, H5F_ACC_RDWR_F, file1_id, error) ! Open the datasets. print*, dsetname1 CALL h5dopen_f(file1_id, dsetname1, dset1_id, error) ! Read dataset from the first file. data_dims(1) = 64 data_dims(2) = 64 print*, data_dims CALL h5dread_f(dset1_id, H5T_NATIVE_DOUBLE, bufnew, data_dims, error) ! Display the data read from dataset "Copy1" write(*,*) "The data in dataset Copy1 is: " do i = 1, 64 print*, i print *, (bufnew(i,j), j = 1,64) end do ! Close datasets. CALL h5dclose_f(dset1_id, error) ! Get number of members in the root group. CALL h5gn_members_f(file1_id, "O", nmembers, error) write(*,*) "Number of root group member is " , nmembers ! Print each group member's name and type. do i = 0, nmembers - 1 CALL h5gget_obj_info_idx_f(file1_id, "/O/", i, name_buffer, htype, & error) write(*,*) name_buffer, htype end do ! Close files. CALL h5fclose_f(file1_id, error) print*, 'files closed' ! Close FORTRAN interface. CALL h5close_f(error) END PROGRAM SELECTEXAMPLE Richard Maine wrote: > Steve Lionel <steve.lionel(a)intel.invalid> wrote: > >> There's an interesting thing here. Compare the call that Ralph says he >> used with the one displayed in the error message - they are quite >> different. > > Excellent point. I missed that. Makes me even more want to see an actual > complete sample, since the tidbits reported seem internally > inconsistent. I'm inclined to guess this is yet another case of telling > us what he thought was wrong instead of showing the original data. >
From: Ralph Kube on 2 Dec 2009 04:31 I just dug and found the h5dread_f subroutine: SUBROUTINE h5dread_reference_obj(dset_id, mem_type_id, buf, dims, hdferr, & mem_space_id, file_space_id, xfer_prp) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims TYPE(hobj_ref_t_f), INTENT(INOUT) , & DIMENSION(dims(1)) :: buf INTEGER, INTENT(OUT) :: hdferr ! Error code INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id ! Memory dataspace identfier INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id ! File dataspace identfier INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp ! Transfer property list identifier INTEGER(HID_T) :: xfer_prp_default INTEGER(HID_T) :: mem_space_id_default INTEGER(HID_T) :: file_space_id_default INTEGER(HADDR_T), ALLOCATABLE, DIMENSION(:) :: ref_buf INTEGER :: j ! INTEGER, EXTERNAL :: h5dread_ref_obj_c ! MS FORTRAN needs explicit interface for C functions called here. ! INTERFACE INTEGER FUNCTION h5dread_ref_obj_c(dset_id, mem_type_id,& mem_space_id_default, & file_space_id_default, xfer_prp_default, ref_buf, dims) USE H5GLOBAL !DEC$IF DEFINED(HDF5F90_WINDOWS) !DEC$ATTRIBUTES C,reference,decorate,alias:'H5DREAD_REF_OBJ_C'::h5dread_ref_obj_c !DEC$ENDIF INTEGER(HID_T), INTENT(IN) :: dset_id INTEGER(HID_T), INTENT(IN) :: mem_type_id INTEGER(HID_T) :: xfer_prp_default INTEGER(HID_T) :: mem_space_id_default INTEGER(HID_T) :: file_space_id_default INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims INTEGER(HADDR_T), DIMENSION(*) :: ref_buf END FUNCTION h5dread_ref_obj_c END INTERFACE allocate(ref_buf(dims(1)), stat=hdferr) if (hdferr .NE. 0) then hdferr = -1 return endif xfer_prp_default = H5P_DEFAULT_F mem_space_id_default = H5S_ALL_F file_space_id_default = H5S_ALL_F if (present(xfer_prp)) xfer_prp_default = xfer_prp if (present(mem_space_id)) mem_space_id_default = mem_space_id if (present(file_space_id)) file_space_id_default = file_space_id hdferr = h5dread_ref_obj_c(dset_id, mem_type_id, mem_space_id_default, & file_space_id_default, xfer_prp_default, ref_buf, dims) do j = 1, dims(1) buf(j)%ref = ref_buf(j) enddo deallocate(ref_buf) END SUBROUTINE h5dread_reference_obj
From: Ralph Kube on 2 Dec 2009 04:40 James Van Buskirk wrote: > Probably a simple mistake on your part. Can you give us the > declarations of dset1_id, H5T_NATIVE_DOUBLE, bufnew, error, dset_id, > and theta? Also the specification parts of the specific subroutines > which generic h5dread_f may resolve to? I posted a working example in another subthread. It is a modified example program from the HDF5 distribution ( as I observed the problem when working with it). I was looking for the definition of H5T_NATIVE_DOUBLE, but could not find it in the HDF5 package. I think it translates to the machine native floating point number, so to a ieee-754 64 bit floating point number on a pentium-d. Cheers, Ralph
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: SuperKISS for 32- and 64-bit RNGs in PL/I. Next: C interop to popen |