我有14,430个HDF5文件。这些HDF5文件中的每个文件都包含一个数据类型为float = 49152 x 21 x 1的数据集。我正在尝试创建一个大小为49152 x 21 x 14430的VDS数据集,以映射所有14,430个文件中的每个数据集。代码运行正常,没有错误,我可以看到它创建了大小为49152 x 21 x 14430的VDS,并将其写入HDF5文件。但是,如果我打开(或)对VDS进行h5转储,我会看到VDS拥有正确的数据,直到49152 x 21 x 1024,而VDS中的其余值均为零。看起来只有前1024个文件被映射,其余的未被映射。但是,如果我对包含VDS的hdf5文件执行“ h5dump -p”操作,则表明所有14,430个文件均已虚拟映射。我不知道的可映射文件的内存(或)数量是否有限制?我错过了什么吗?我附上以下代码以供参考。我正在使用HDF5 1.10.3。预先感谢。
#define REAL float
#define H5T_NATIVE_RL H5T_NATIVE_FLOAT
#define MPI_RL MPI_FLOAT
#define RANK 2
#define PAR_RANK 3
#define LENLINE 4096
#define MAXLEN 256
#define DOMAINDATA 6
#define GRIDDATA 6
#define MAXFILE 20000
hid_t vdcpl_id;
hid_t vds_space_id;
hid_t src_dataspace_id;
hid_t vdset_id;
hsize_t vdims[PAR_RANK];
hsize_t src_dims[PAR_RANK];
hsize_t voffset[PAR_RANK];
hsize_t vcount[PAR_RANK];
hsize_t vstride[PAR_RANK];
hsize_t vblock[PAR_RANK];
vdcpl_id = H5Pcreate(H5P_DATASET_CREATE);
vdims[0] = 49152;
vdims[1] = 21;
vdims[2] = iEndFrame-iStartFrame+1;
vds_space_id = H5Screate_simple(PAR_RANK, vdims, NULL);
offset[0] = 0;
offset[1] = 0;
offset[2] = 0;
count[0] = 1;
count[1] = 1;
count[2] = 1;
stride[0] = 1;
stride[1] = 1;
stride[2] = 1;
block[0] = 49152;
block[1] = 21;
block[2] = 1;
src_dims[2] = 1;
src_dims[1] = 21;
src_dims[0] = 49152;
for(i=iStartFrame; i<=iEndFrame; i++)
{
frameIndex = i - iStartFrame;
voffset[0] = 0;
voffset[1] = 0;
voffset[2] = frameIndex;
vstride[0] = 1;
vstride[1] = 1;
vstride[2] = 1;
vblock[0] = 49152;
vblock[1] = 21;
vblock[2] = 1;
vcount[0] = 1;
vcount[1] = 1;
vcount[2] = 1;
src_dataspace_id = H5Screate_simple(PAR_RANK, src_dims, NULL);
H5Sselect_hyperslab(src_dataspace_id, H5S_SELECT_SET, offset, stride, block, count);
H5Sselect_hyperslab(vds_space_id, H5S_SELECT_SET, voffset, vstride, vblock, vcount);
sprintf(hdf5FileName, "ParData.%s.%d.h5",probName,frameIndex);
sprintf(parDSetName, "/Particles/particle_%d", frameIndex );
status = H5Pset_virtual(vdcpl_id, vds_space_id, hdf5FileName, parDSetName, src_dataspace_id);
if(status < 0){
printf("Proc:%04d ************** Failed creating virtual mapping %s ****************\n\n",
my_id, hdf5FileName);
return 1;
}
printf("Proc:%04d ************** Creating virtual mapping %s ****************\n\n",
my_id, hdf5FileName);
H5Sclose(src_dataspace_id);
}
sprintf(hdf5FileName, "ParData.%s.0.h5",probName);
file_id = H5Fopen(hdf5FileName, H5F_ACC_RDWR, H5P_DEFAULT);
/* Create VDS in the 0th frame HDF5 file inside the Particles Grp. */
parGrp_id = H5Gopen1(file_id, "/Particles");
vdset_id = H5Dcreate(parGrp_id, "VDS", H5T_NATIVE_RL, vds_space_id, H5P_DEFAULT,
vdcpl_id, H5P_DEFAULT);
H5Sclose(vds_space_id);
H5Gclose(parGrp_id);
H5Dclose(vdset_id);
H5Pclose(vdcpl_id);
H5Fclose(file_id);