Hi Barbara,

Thank you for an answer!
Yes, your code also works fine on my side, BUT...
when I try to set some custom H5P_FILE_ACCESS by call:

H5Pset_fapl_mpio(plist_id, comm, info)

(so running this example under OpenMPI - even for 1 process only)
it DOES NOT work any more.
In that case (see attached slightly modified your code) I've got the following output:

2: H5Pcreate: OK
2: H5Pset_fapl_mpio: OK
2: H5Fcreate: OK
2: H5Screate_simple: OK
2: H5Dcreate2: OK
2: H5Dclose: OK
2: H5Sclose: OK
2: H5Pclose: OK
2: H5Fclose: OK
2: H5Pcreate: OK
2: H5Pset_fapl_mpio: OK
2: H5Fopen: OK
2: H5Dopen2 Failed!
2: H5Dget_space Failed!
2: H5Dclose Failed!
2: H5Sclose Failed!
2: H5Pclose: OK
2: H5Fclose: OK

HDF5 library also reports some error messages in that case:
        unable to open dataset
        unable to initialize file storage
        unable to mark dataspace as dirty
        unable to update layout info
        unable to write object header message
        unable to modify constant message

The most interesting thing is (which possibly means it's a bug), that when in the same code I just change dims definition to:

   dims[0] = 1;
   dims[1] = 1;

everything WORKS FINE now! :-)

Best regards,
Rafal



W dniu 2017-10-26 o 17:53, Barbara Jones pisze:

Hi Rafal,

I am able to create a dataset with zero dimensions, close it, and re-open. (See 
attached).
Can you send us an example of what you are trying that fails?
Please send it to the helpdesk: h...@hdfgroup.org

Thanks!
-Barbara
h...@hdfgroup.org

-----Original Message-----
From: Hdf-forum [mailto:hdf-forum-boun...@lists.hdfgroup.org] On Behalf Of Gerd 
Heber
Sent: Thursday, October 26, 2017 6:49 AM
To: HDF Users Discussion List
Subject: Re: [Hdf-forum] HDF5 library bug or feature?

Rafal, this might be a bug.

Is there any way to record/track this issue?

Not sure. Helpdesk will check. (It's still early morning here...)

G.

_______________________________________________
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



_______________________________________________
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



#include "hdf5.h"

#define FILE "rafal.h5"


int main(int argc, char **argv) {

   hid_t       file_id, dataset_id, dataspace_id, plist_id;  /* identifiers */
   hsize_t     dims[2];
   herr_t      status;

    int mpi_size, mpi_rank;
    MPI_Comm comm  = MPI_COMM_WORLD;
    MPI_Info info  = MPI_INFO_NULL;

    /*
     * Initialize MPI
     */
    MPI_Init(&argc, &argv);
    MPI_Comm_size(comm, &mpi_size);
    MPI_Comm_rank(comm, &mpi_rank);  

   if ((plist_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
      printf ("H5Pcreate Failed!\n");
   else printf ("H5Pcreate: OK\n");

   if (H5Pset_fapl_mpio(plist_id, comm, info) < 0)
      printf ("H5Pset_fapl_mpio Failed!\n");
   else printf ("H5Pset_fapl_mpio: OK\n");
    
   /* Create a new file using custom H5P_FILE_ACCESS property. */
   if ((file_id = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, plist_id)) < 0)
      printf ("H5Fcreate Failed!\n");
   else printf ("H5Fcreate: OK\n");
   
   /* Create the data space for the dataset. */
   dims[0] = 1; 
   dims[1] = 1; 
   if ((dataspace_id = H5Screate_simple(2, dims, NULL)) < 0)
      printf ("H5Screate_simple fails!\n");
   else printf ("H5Screate_simple: OK\n");

   /* Create the dataset. */
   if ((dataset_id = H5Dcreate2(file_id, "/dset", H5T_STD_I32BE, dataspace_id, 
                          H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
      printf ("H5Dcreate2 Failed!\n");
   else printf ("H5Dcreate2: OK\n");

   /* End access to the dataset and release resources used by it. */
   if ((status = H5Dclose(dataset_id)) < 0)
     printf ("H5Dclose Failed!\n");
   else printf ("H5Dclose: OK\n");

   if ((status = H5Sclose(dataspace_id)) < 0)
     printf ("H5Sclose Failed!\n");
   else printf ("H5Sclose: OK\n");

   if ((status = H5Pclose(plist_id)) < 0)
     printf ("H5Pclose Failed!\n");
   else printf ("H5Pclose: OK\n");

   if ((status = H5Fclose(file_id)) < 0)
     printf ("H5Fclose Failed!\n");
   else printf ("H5Fclose: OK\n");

   if ((plist_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
      printf ("H5Pcreate Failed!\n");
   else printf ("H5Pcreate: OK\n");

   if (H5Pset_fapl_mpio(plist_id, comm, info) < 0)
      printf ("H5Pset_fapl_mpio Failed!\n");
   else printf ("H5Pset_fapl_mpio: OK\n");
    
   if ((file_id = H5Fopen (FILE, H5F_ACC_RDWR, plist_id)) < 0)
     printf ("H5Fopen Failed!\n");
   else printf ("H5Fopen: OK\n");

   if ((dataset_id = H5Dopen2(file_id, "/dset", H5P_DEFAULT)) < 0) 
     printf ("H5Dopen2 Failed!\n");
   else printf ("H5Dopen2: OK\n");

   if ((dataspace_id = H5Dget_space (dataset_id)) < 0)
     printf ("H5Dget_space Failed!\n");
   else printf ("H5Dget_space: OK\n");

   if ((status = H5Dclose(dataset_id)) < 0)
     printf ("H5Dclose Failed!\n");
   else printf ("H5Dclose: OK\n");
 
   /* Terminate access to the data space. */ 
   if ((status = H5Sclose(dataspace_id)) < 0)
     printf ("H5Sclose Failed!\n");
   else printf ("H5Sclose: OK\n");

   if ((status = H5Pclose(plist_id)) < 0)
     printf ("H5Pclose Failed!\n");
   else printf ("H5Pclose: OK\n");

   /* Close the file. */
   if ((status = H5Fclose(file_id)) < 0)
     printf ("H5Fclose Failed!\n");
   else printf ("H5Fclose: OK\n");
   
    MPI_Finalize();

   return 0;
}
_______________________________________________
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

Reply via email to