MPI + HDF5

Hello,
I am trying to use the solution proposed in
http://www.hdfgroup.org/HDF5/faq/pll-conf.html#1proc (root task write
HDF file in serial) to store some data generated by an MPI
application.

The problem is quite simple, and it's generated by this portion of code:

   if (rank == 0) {

    file_id = H5Fopen ("maps.h5" , H5F_ACC_RDWR, H5P_DEFAULT);
    /* I/O stuff */
    status = H5Fclose (file_id);

   }

The program compiles without errors, but at runtime I get e following
error (plus a bunch of other stuff):

HDF5-DIAG: Error detected in HDF5 (1.8.4) thread 140538731431680:
  #000: ../../../src/H5F.c line 1512 in H5Fopen(): unable to open file
    major: File accessability
    minor: Unable to open file
  #001: ../../../src/H5F.c line 1216 in H5F_open(): unable to open file
    major: File accessability
    minor: Unable to open file
  #002: ../../../src/H5FD.c line 1079 in H5FD_open(): open failed
    major: Virtual File Layer
    minor: Unable to initialize object

What am I doing wrong?

Thanks,

Francesco

PS Here is the configuration of my HDF5 system:

h5cc -showconfig
      SUMMARY OF THE HDF5 CONFIGURATION

···

=================================

General Information:
-------------------
       HDF5 Version: 1.8.4
      Configured on: Mon Feb 15 20:19:46 UTC 2010
      Configured by: root@crested
     Configure mode: production
        Host system: x86_64-pc-linux-gnu
        Uname information: Linux crested 2.6.24-23-server #1 SMP Wed
Apr 1 22:14:30 UTC 2009 x86_64 GNU/Linux
           Byte sex: little-endian
          Libraries:
       Installation point: /usr

Compiling Options:
------------------
               Compilation Mode: production
                     C Compiler: /usr/bin/gcc (gcc-4.4.3)
                         CFLAGS: -O0
                      H5_CFLAGS: -std=c99 -pedantic -Wall -Wextra
-Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual
-Wcast-align -Wwrite-strings -Wconversion -Waggregate-return
-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
-Wredundant-decls -Wnested-externs -Winline -Wno-long-long
-Wfloat-equal -Wmissing-format-attribute -Wmissing-noreturn -Wpacked
-Wdisabled-optimization -Wformat=2 -Wunreachable-code -Wendif-labels
-Wdeclaration-after-statement -Wold-style-definition -Winvalid-pch
-Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs
-Wswitch-default -Wswitch-enum -Wunused-macros
-Wunsafe-loop-optimizations -Wc++-compat -Wstrict-overflow
-Wlogical-op -Wlarger-than=2048 -Wvla -Wsync-nand
-Wframe-larger-than=16384 -Wpacked-bitfield-compat -O0
-fomit-frame-pointer -finline-functions
                      AM_CFLAGS:
                       CPPFLAGS:
                    H5_CPPFLAGS: -D_POSIX_SOURCE -DNDEBUG -UH5_DEBUG_API
                    AM_CPPFLAGS: -D_LARGEFILE_SOURCE
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_BSD_SOURCE
               Shared Libraries: yes
               Static Libraries: yes
  Statically Linked Executables: no
                        LDFLAGS: -Wl,-Bsymbolic-functions
                     AM_LDFLAGS:
      Extra libraries: -lpthread -lz -lm
            Archiver: ar
         Ranlib: ranlib
         Debugged Packages:
        API Tracing: no

Languages:
----------
                        Fortran: yes
               Fortran Compiler: gfortran
                  Fortran Flags:
               H5 Fortran Flags:
               AM Fortran Flags: -O0
                            C++: yes
                   C++ Compiler: g++
                      C++ Flags: -O0
                   H5 C++ Flags:
                   AM C++ Flags:

Features:
---------
                  Parallel HDF5: no
             High Level library: yes
                   Threadsafety: yes
            Default API Mapping: v16
With Deprecated Public Symbols: yes
         I/O filters (external): deflate(zlib)
         I/O filters (internal): shuffle,fletcher32,nbit,scaleoffset
                            MPE: no
                     Direct VFD: no
                        dmalloc: no
Clear file buffers before write: yes
           Using memory checker: no
         Function Stack Tracing: no
                           GPFS: no
      Strict File Format Checks: no
   Optimization Instrumentation: no
Linux Large File Support (LFS): yes

Hi Francesco,

Hello,
I am trying to use the solution proposed in
http://www.hdfgroup.org/HDF5/faq/pll-conf.html#1proc (root task write
HDF file in serial) to store some data generated by an MPI
application.

The problem is quite simple, and it's generated by this portion of code:

  if (rank == 0) {

   file_id = H5Fopen ("maps.h5" , H5F_ACC_RDWR, H5P_DEFAULT);
   /* I/O stuff */
   status = H5Fclose (file_id);

  }

The program compiles without errors, but at runtime I get e following
error (plus a bunch of other stuff):

HDF5-DIAG: Error detected in HDF5 (1.8.4) thread 140538731431680:
#000: ../../../src/H5F.c line 1512 in H5Fopen(): unable to open file
   major: File accessability
   minor: Unable to open file
#001: ../../../src/H5F.c line 1216 in H5F_open(): unable to open file
   major: File accessability
   minor: Unable to open file
#002: ../../../src/H5FD.c line 1079 in H5FD_open(): open failed
   major: Virtual File Layer
   minor: Unable to initialize object

What am I doing wrong?

  Hard to tell from your example code, what you are doing should work. Can you send a full program that fails?

  Quincey

···

On Mar 25, 2011, at 5:21 PM, Francesco Petrogalli wrote:

Thanks,

Francesco

PS Here is the configuration of my HDF5 system:

h5cc -showconfig
      SUMMARY OF THE HDF5 CONFIGURATION
      =================================

General Information:
-------------------
       HDF5 Version: 1.8.4
      Configured on: Mon Feb 15 20:19:46 UTC 2010
      Configured by: root@crested
     Configure mode: production
        Host system: x86_64-pc-linux-gnu
        Uname information: Linux crested 2.6.24-23-server #1 SMP Wed
Apr 1 22:14:30 UTC 2009 x86_64 GNU/Linux
           Byte sex: little-endian
          Libraries:
       Installation point: /usr

Compiling Options:
------------------
              Compilation Mode: production
                    C Compiler: /usr/bin/gcc (gcc-4.4.3)
                        CFLAGS: -O0
                     H5_CFLAGS: -std=c99 -pedantic -Wall -Wextra
-Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual
-Wcast-align -Wwrite-strings -Wconversion -Waggregate-return
-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
-Wredundant-decls -Wnested-externs -Winline -Wno-long-long
-Wfloat-equal -Wmissing-format-attribute -Wmissing-noreturn -Wpacked
-Wdisabled-optimization -Wformat=2 -Wunreachable-code -Wendif-labels
-Wdeclaration-after-statement -Wold-style-definition -Winvalid-pch
-Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs
-Wswitch-default -Wswitch-enum -Wunused-macros
-Wunsafe-loop-optimizations -Wc++-compat -Wstrict-overflow
-Wlogical-op -Wlarger-than=2048 -Wvla -Wsync-nand
-Wframe-larger-than=16384 -Wpacked-bitfield-compat -O0
-fomit-frame-pointer -finline-functions
                     AM_CFLAGS:
                      CPPFLAGS:
                   H5_CPPFLAGS: -D_POSIX_SOURCE -DNDEBUG -UH5_DEBUG_API
                   AM_CPPFLAGS: -D_LARGEFILE_SOURCE
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_BSD_SOURCE
              Shared Libraries: yes
              Static Libraries: yes
Statically Linked Executables: no
                       LDFLAGS: -Wl,-Bsymbolic-functions
                    AM_LDFLAGS:
     Extra libraries: -lpthread -lz -lm
           Archiver: ar
        Ranlib: ranlib
        Debugged Packages:
        API Tracing: no

Languages:
----------
                       Fortran: yes
              Fortran Compiler: gfortran
                 Fortran Flags:
              H5 Fortran Flags:
              AM Fortran Flags: -O0
                           C++: yes
                  C++ Compiler: g++
                     C++ Flags: -O0
                  H5 C++ Flags:
                  AM C++ Flags:

Features:
---------
                 Parallel HDF5: no
            High Level library: yes
                  Threadsafety: yes
           Default API Mapping: v16
With Deprecated Public Symbols: yes
        I/O filters (external): deflate(zlib)
        I/O filters (internal): shuffle,fletcher32,nbit,scaleoffset
                           MPE: no
                    Direct VFD: no
                       dmalloc: no
Clear file buffers before write: yes
          Using memory checker: no
        Function Stack Tracing: no
                          GPFS: no
     Strict File Format Checks: no
  Optimization Instrumentation: no
Linux Large File Support (LFS): yes

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

Hi Quincey,

   Hard to tell from your example code, what you are doing should work\.  Can you send a full program that fails?

it was a trivial bug in my code. I forgot to insert the file create statement.

Thanks,

Francesco