HDF5 无法创建文件错误

Posted

技术标签:

【中文标题】HDF5 无法创建文件错误【英文标题】:HDF5 unable to create file error 【发布时间】:2017-04-27 13:41:39 【问题描述】:

我处理 Fortran 代码,它使用 HDF5 库转储输出数据。我一直在超级计算机上运行代码,没有任何问题。最近,我在机器上安装了 HDF5 库的本地集群上尝试了代码。但是,代码运行良好,除了在输出部分抛出以下错误。

我已经在互联网上广泛搜索了这个问题。但是,我看到的大多数解决方案都高度特定于他们的代码。我相信这个错误是由于一些基本问题造成的。谁能解释一下,为什么会出现错误?

15:34:05 -   Dumping OD...
HDF5-DIAG: Error detected in HDF5 (1.8.17) MPI-process 0:
  #000: H5F.c line 522 in H5Fcreate(): unable to create file
    major: File accessibilty
    minor: Unable to open file
  #001: H5Fint.c line 992 in H5F_open(): unable to open file: time = Mon Dec 12 15:34:05 2016
, name = './Production/od_out_t00000010-0067858932.h5', tent_flags = 13
    major: File accessibilty
    minor: Unable to open file
  #002: H5FD.c line 993 in H5FD_open(): open failed
    major: Virtual File Layer
    minor: Unable to initialize object
  #003: H5FDmpio.c line 1059 in H5FD_mpio_open(): MPI_File_open failed
    major: Internal error (too specific to document in detail)
    minor: Some MPI function failed
  #004: H5FDmpio.c line 1059 in H5FD_mpio_open(): MPI_ERR_FILE: invalid file
    major: Internal error (too specific to document in detail)
    minor: MPI Error String
HDF5-DIAG: Error detected in HDF5 (1.8.17) MPI-process 0:
  #000: H5D.c line 165 in H5Dcreate2(): not a location ID
    major: Invalid arguments to routine
    minor: Inappropriate type
  #001: H5Gloc.c line 253 in H5G_loc(): invalid object ID
    major: Invalid arguments to routine
    minor: Bad value
HDF5-DIAG: Error detected in HDF5 (1.8.17) MPI-process 0:
  #000: H5D.c line 460 in H5Dget_space(): not a dataset
    major: Invalid arguments to routine
    minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.8.17) 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.17) MPI-process 0:
  #000: H5S.c line 392 in H5Sclose(): not a dataspace
    major: Invalid arguments to routine
    minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.8.17) MPI-process 0:
  #000: H5D.c line 415 in H5Dclose(): not a dataset
    major: Invalid arguments to routine
    minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.8.17) MPI-process 0:
  #000: H5F.c line 774 in H5Fclose(): not a file ID
    major: Invalid arguments to routine
    minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.8.17) MPI-process 0:
  #000: H5F.c line 604 in H5Fopen(): unable to open file
    major: File accessibilty
    minor: Unable to open file
  #001: H5Fint.c line 992 in H5F_open(): unable to open file: time = Mon Dec 12 15:34:05 2016
, name = './Production/od_out_t00000010-0067858932.h5', tent_flags = 1
    major: File accessibilty
    minor: Unable to open file
  #002: H5FD.c line 993 in H5FD_open(): open failed
    major: Virtual File Layer
    minor: Unable to initialize object
  #003: H5FDsec2.c line 339 in H5FD_sec2_open(): unable to open file: name = './Production/od_out_t00000010-0067858932.h5', errno = 2, error message = 'No such file or directory', flags = 1, o_flags = 2
    major: File accessibilty
    minor: Unable to open file
HDF5-DIAG: Error detected in HDF5 (1.8.17) MPI-process 0:
  #000: H5D.c line 340 in H5Dopen2(): not a location
    major: Invalid arguments to routine
    minor: Inappropriate type
  #001: H5Gloc.c line 253 in H5G_loc(): invalid object ID
    major: Invalid arguments to routine
    minor: Bad value
HDF5-DIAG: Error detected in HDF5 (1.8.17) MPI-process 0:
  #000: H5A.c line 247 in H5Acreate2(): not a location
    major: Invalid arguments to routine
    minor: Inappropriate type
  #001: H5Gloc.c line 253 in H5G_loc(): invalid object ID
    major: Invalid arguments to routine
    minor: Bad value
HDF5-DIAG: Error detected in HDF5 (1.8.17) MPI-process 0:
  #000: H5A.c line 591 in H5Awrite(): not an attribute
    major: Invalid arguments to routine
    minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.8.17) MPI-process 0:
  #000: H5A.c line 1602 in H5Aclose(): not an attribute
    major: Invalid arguments to routine
    minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.8.17) MPI-process 0:
  #000: H5D.c line 415 in H5Dclose(): not a dataset
    major: Invalid arguments to routine
    minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.8.17) MPI-process 0:
  #000: H5F.c line 774 in H5Fclose(): not a file ID
    major: Invalid arguments to routine
    minor: Inappropriate type
15:34:05 - Finished dumping HDF5 data.

【问题讨论】:

您是否拥有在所选位置写入文件所需的权限? 我刚刚touch在输出的同一目录中创建了一个测试文件。我有必要的写权限。 我刚刚发现有人有类似的错误:groups.google.com/forum/#!topic/pflotran-users/ZPqqkROX9hc。对话中的第三条评论提到从 Intel v16 降级到 v15 解决了这个问题。我现在也使用 Intel v16。您对为什么会发生这种情况有何看法? 小精灵,可能是小精灵。 你能显示你打开文件的代码吗?我能看到的唯一实质性信息是没有这样的文件或目录,这将指示错误的打开标志(期望现有、创建和附加)。第二个提示是 not a location 与相对路径“./”相关 - 更改为绝对路径并重试;承认,奇怪的是它在一个系统上工作而在另一个系统上失败,但是修改打开标志或调整当前目录可以工作。 【参考方案1】:

我的建议是添加

CALL h5dclose_f(dset_id, ierr)    ! terminate create dataset;

对于每个数据写入操作。它对我有用。

【讨论】:

最好不要使用“我有类似的问题”。乍一看,您可能看起来像是在问,有些人可能不会进一步阅读并标记您的问题或其他内容。

以上是关于HDF5 无法创建文件错误的主要内容,如果未能解决你的问题,请参考以下文章

无法写入 hdf5 文件

如何在现有 HDF5 文件上创建组? (HDF5)

C++ 代码创建空 HDF5 文件而不是数据集

使用 pandas 读取 hdf5 数据集

(C++) 在 HDF5 中编写数据库

在 HDF5 文件中创建和访问数据集