I have to continuously acquire and save 512 analog signals on disk for an indefinite time.
Application created with MSVC15 and LabWindows / CVI / 2019. For connection needs with the data acquisition system, the application is developed in 32 bit.
I downloaded hdf5-1.12.0 and compiled with MSVC15 + cMake as indicated.
The application creates an H5 file with a two-dimensional 192 data-set (time-value). One data set per channel.
The created file is correct, HDFView-3.1.0 displayed.
The application generates approximately 500 Gbytes of data per day.
The problem is that it increases the use of the system RAM until it reaches RAM saturation after 2-3 days of work.
Then when the RAM is full, the application goes into error because it can no longer allocate more memory.
PC with Windows 10/64 bit, 8GB, and 16GB of virtual memory.
Creazione file --------------------------------------------------------------------------------------------------------------------------------------
if ( (LowLevelAcq->file_id = H5Fcreate( “file_name.h5” , H5F_ACC_TRUNC , H5P_DEFAULT , H5P_DEFAULT )) < 0 ) H5_ERROR_GOTO
if ( (LowLevelAcq->datatype = H5Tcopy( H5T_NATIVE_DOUBLE )) < 0 ) H5_ERROR_GOTO if ( H5Tset_order( LowLevelAcq->datatype, H5T_ORDER_LE ) < 0 ) H5_ERROR_GOTO
if ( (pnt_ch->gid_a = H5Gcreate2( LowLevelAcq->file_id , “Generic” , H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) H5_ERROR_GOTO
if ( (pnt_ch->gid_b = H5Gcreate2( pnt_ch->gid_a , "channel_name(1…192) , H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) H5_ERROR_GOTO
if ( (pnt_ch->gid_c = H5Gcreate2( pnt_ch->gid_b , “RAW” , H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) H5_ERROR_GOTO
if ( (pnt_ch->gid_d = H5Gcreate2( pnt_ch->gid_b , “PreProcess” , H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) H5_ERROR_GOTO
Creazione data-set --------------------------------------------------------------------------------------------------------------------------------------
if ( (pnt_ch->plist = H5Pcreate ( H5P_DATASET_CREATE )) < 0 ) H5_ERROR_GOTO
if ( H5Pset_chunk ( pnt_ch->plist, RANK, chunk_dims ) < 0 ) H5_ERROR_GOTO
if ( (pnt_ch->dataspace_id = H5Screate_simple ( RANK, dims, maxdims )) < 0 ) H5_ERROR_GOTO
if ( (pnt_ch->dataset_id = H5Dcreate2( pnt_ch->gid_c , "date_time , LowLevelAcq->datatype, pnt_ch->dataspace_id, H5P_DEFAULT , pnt_ch->plist , H5P_DEFAULT )) < 0 ) H5_ERROR_GOTO
dapl = H5Dget_access_plist(pnt_ch->dataset_id);
mdc_nelmts = 0;
status = H5Pget_cache( dapl, &mdc_nelmts, &rdcc_nslots, &rdcc_nbytes, &rdcc_w0 );
status = H5Pget_chunk_cache( dapl, &rdcc_nslots, &rdcc_nbytes, &rdcc_w0 ); rdcc_nslots = 0; rdcc_nbytes = 0;
//rdcc_w0 = 0
status = H5Pset_chunk_cache( dapl, rdcc_nslots, rdcc_nbytes, rdcc_w0 );
Loop Scrittura --------------------------------------------------------------------------------------------------------------------------------------
Parte di scrittura ripetura per canale. Eseguita circa ogni 1 millisec.
if ( pnt_ch->dataset_id )
{
offset[0] = pnt_ch->size; // row
offset[1] = 0; //colum; //1; //0; // col
count [0] = itms;
count [1] = colum; //1;
//stride [0] = 1;
//stride [1] = 1;
new_size[0] = pnt_ch->size +itms;
new_size[1] = RANK;
if ( H5Dset_extent( pnt_ch->dataset_id, new_size ) < 0 ) H5_ERROR_GOTO
if ( (pnt_ch->filespace_id = H5Dget_space( pnt_ch->dataset_id )) < 0 ) H5_ERROR_GOTO
if ( H5Sselect_hyperslab( pnt_ch->filespace_id , H5S_SELECT_SET , offset , NULL , count , NULL ) < 0 ) H5_ERROR_GOTO
if ( H5Sset_extent_simple( pnt_ch->dataspace_id, RANK , count , count ) < 0 ) H5_ERROR_GOTO
if ( H5Dwrite( pnt_ch->dataset_id, LowLevelAcq->datatype, pnt_ch->dataspace_id, pnt_ch->filespace_id, H5P_DEFAULT, Waveform ) < 0 ) H5_ERROR_GOTO
pnt_ch->size += itms;
}
Thank you.