Code from the CPP example breaks for larger matrix size


#1

Hello there.

I am new to HDF5 and as a first step, I tried to run one of the examples on my computer.
The example itself works just fine, but then, when I change the dimensions of the dataset, my program breaks with a Stack Overflow exception.

I used the example from here.

and changed

const int DIM0 = 4; // dataset dimensions
const int DIM1 = 6;

to

const int DIM0 = 1080; // dataset dimensions
const int DIM1 = 1920;

This is what happens when I run it.

Configuration details
OS : Windows 10 Pro
IDE : Microsoft Visual Studio 2017 (v. 15.4.5)
HDF5 version 1.10.3

Can someone tell me what I am doing wrong?

Thanks in advance!


#2

Hello!

The example that you are running (h5tutr_rdwt.cpp) opens a dataset in an HDF5 file created by another program (h5tutr_crtdat.cpp). The size of the dataset in the file is 4 x 6. Change the dataset size to 1080 x 1920 in h5tutr_crtdat.cpp, and run that. Then run your modified h5tutr_rdwt.cpp program to write to the dataset.

The h5dump utility in the bin/ directory of the HDF5 binary distribution can be used to examine the HDF5 file. For example:

$ h5dump -H h5tutr_dset.h5
HDF5 “h5tutr_dset.h5” {
GROUP “/” {
DATASET “dset” {
DATATYPE H5T_STD_I32BE
DATASPACE SIMPLE { ( 1080, 1920 ) / ( 1080, 1920 ) }
}
}
}

-Barbara
help@hdfgroup.org