question on file path specification

Hello,

I am a new user with a basic question regarding specifying the directory location for a file that I would like to create.

I have an existing Fortran code that is currently setup to use the FITS libraries for I/O, and I'm trying to get it setup so that HDF5 can alternatively be used for I/O.

The subroutine I have for creating and writing to an HDF5 file seems to work fine when trying to write out a file to the current directory, but it runs into problems when trying to specify a more complex path for the file creation.

As an example,

call h5fcreate_f('file.h5',H5F_ACC_TRUNC_F,fid,error)

seems to work just fine in creating the desired file 'file.h5' in the current directory. However,

call h5fcreate_f('/work/file.h5',H5F_ACC_TRUNC_F,fid,error)

runs into problems. It does create a file 'file.h5' in directory '/work', however, it returns errors and the file is empty. I have pasted below the errors that are returned in the *.o file

Thanks!

HDF5-DIAG: Error detected in HDF5 (1.8.4) MPI-process 0:
#000: H5D.c line 171 in H5Dcreate2(): unable to create dataset
major: Dataset
minor: Unable to initialize object
#001: H5Dint.c line 428 in H5D_create_named(): unable to create and link to dataset
major: Dataset
minor: Unable to initialize object
#002: H5L.c line 1639 in H5L_link_object(): unable to create new link to object
major: Links
minor: Unable to initialize object
#003: H5L.c line 1862 in H5L_create_real(): can't insert link
major: Symbol table
minor: Unable to insert object
#004: H5Gtraverse.c line 877 in H5G_traverse(): internal path traversal failed
major: Symbol table
minor: Object not found
#005: H5Gtraverse.c line 776 in H5G_traverse_real(): component not found
major: Symbol table
minor: Object not found
HDF5-DIAG: Error detected in HDF5 (1.8.4) MPI-process 0:
#000: H5Dio.c line 228 in H5Dwrite(): not a dataset
major: Invalid arguments to routine
minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.8.4) MPI-process 0:
#000: H5D.c line 378 in H5Dclose(): not a dataset
major: Invalid arguments to routine
minor: Inappropriate type

Daniel,

It looks like you are using parallel HDF5.

The call to h5fcreate_f would be slightly different in a parallel case: you need to specify an access property list that is set up for parallel access as shown here:

    .......

     !
     ! Setup file access property list with parallel I/O access.
     !
     CALL h5pcreate_f(H5P_FILE_ACCESS_F, plist_id, error)
                                         ^^^^^^^^
     CALL h5pset_fapl_mpio_f(plist_id, comm, info, error)
                             ^^^^^^^^^

     !
     ! Create the file collectively.
                       ^^^^^^^^^^^^
     !
     CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error, access_prp = plist_id)
    ........ ^^^^^^^^^^^^^^^^^^^^^^

File has to be created collectively, i.e., ALL processes in communicator should participate.

Please see Parallel Tutorial http://www.hdfgroup.org/HDF5/Tutor/parallel.html, and Fortran example http://www.hdfgroup.org/HDF5/Tutor/pcrtaccd.html.

Elena

···

On Jan 25, 2011, at 12:10 PM, Daniel Dombroski wrote:

Hello,

I am a new user with a basic question regarding specifying the directory location for a file that I would like to create.

I have an existing Fortran code that is currently setup to use the FITS libraries for I/O, and I'm trying to get it setup so that HDF5 can alternatively be used for I/O.

The subroutine I have for creating and writing to an HDF5 file seems to work fine when trying to write out a file to the current directory, but it runs into problems when trying to specify a more complex path for the file creation.

As an example,

call h5fcreate_f('file.h5',H5F_ACC_TRUNC_F,fid,error)

seems to work just fine in creating the desired file 'file.h5' in the current directory. However,

call h5fcreate_f('/work/file.h5',H5F_ACC_TRUNC_F,fid,error)

runs into problems. It does create a file 'file.h5' in directory '/work', however, it returns errors and the file is empty. I have pasted below the errors that are returned in the *.o file

Thanks!

HDF5-DIAG: Error detected in HDF5 (1.8.4) MPI-process 0:
#000: H5D.c line 171 in H5Dcreate2(): unable to create dataset
major: Dataset
minor: Unable to initialize object
#001: H5Dint.c line 428 in H5D_create_named(): unable to create and link to dataset
major: Dataset
minor: Unable to initialize object
#002: H5L.c line 1639 in H5L_link_object(): unable to create new link to object
major: Links
minor: Unable to initialize object
#003: H5L.c line 1862 in H5L_create_real(): can't insert link
major: Symbol table
minor: Unable to insert object
#004: H5Gtraverse.c line 877 in H5G_traverse(): internal path traversal failed
major: Symbol table
minor: Object not found
#005: H5Gtraverse.c line 776 in H5G_traverse_real(): component not found
major: Symbol table
minor: Object not found
HDF5-DIAG: Error detected in HDF5 (1.8.4) MPI-process 0:
#000: H5Dio.c line 228 in H5Dwrite(): not a dataset
major: Invalid arguments to routine
minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.8.4) MPI-process 0:
#000: H5D.c line 378 in H5Dclose(): not a dataset
major: Invalid arguments to routine
minor: Inappropriate type

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