@@ -864,7 +864,7 @@ void lightcone_flush_particle_buffers(struct lightcone_props *props, double a,
864
864
if ((types_to_flush > 0 ) || (end_file && props -> file_needs_finalizing )) {
865
865
866
866
/* We have data to flush, so open or create the output file */
867
- hid_t file_id ;
867
+ hid_t file_id , h_props ;
868
868
char fname [FILENAME_BUFFER_SIZE ];
869
869
if (props -> start_new_file ) {
870
870
@@ -873,8 +873,14 @@ void lightcone_flush_particle_buffers(struct lightcone_props *props, double a,
873
873
particle_file_name (fname , FILENAME_BUFFER_SIZE , props -> subdir ,
874
874
props -> basename , props -> current_file , engine_rank );
875
875
876
+ h_props = H5Pcreate (H5P_FILE_ACCESS );
877
+ herr_t err =
878
+ H5Pset_libver_bounds (h_props , HDF5_LOWEST_FILE_FORMAT_VERSION ,
879
+ HDF5_HIGHEST_FILE_FORMAT_VERSION );
880
+ if (err < 0 ) error ("Error setting the hdf5 API version" );
881
+
876
882
/* Create the file */
877
- file_id = H5Fcreate (fname , H5F_ACC_TRUNC , H5P_DEFAULT , H5P_DEFAULT );
883
+ file_id = H5Fcreate (fname , H5F_ACC_TRUNC , H5P_DEFAULT , h_props );
878
884
if (file_id < 0 ) error ("Unable to create new lightcone file: %s" , fname );
879
885
880
886
/* This new file has not been finalized yet */
@@ -924,10 +930,16 @@ void lightcone_flush_particle_buffers(struct lightcone_props *props, double a,
924
930
925
931
} else {
926
932
933
+ h_props = H5Pcreate (H5P_FILE_ACCESS );
934
+ herr_t err =
935
+ H5Pset_libver_bounds (h_props , HDF5_LOWEST_FILE_FORMAT_VERSION ,
936
+ HDF5_HIGHEST_FILE_FORMAT_VERSION );
937
+ if (err < 0 ) error ("Error setting the hdf5 API version" );
938
+
927
939
/* Re-open an existing file */
928
940
particle_file_name (fname , FILENAME_BUFFER_SIZE , props -> subdir ,
929
941
props -> basename , props -> current_file , engine_rank );
930
- file_id = H5Fopen (fname , H5F_ACC_RDWR , H5P_DEFAULT );
942
+ file_id = H5Fopen (fname , H5F_ACC_RDWR , h_props );
931
943
if (file_id < 0 )
932
944
error ("Unable to open current lightcone file: %s" , fname );
933
945
}
@@ -969,6 +981,7 @@ void lightcone_flush_particle_buffers(struct lightcone_props *props, double a,
969
981
970
982
/* We're done updating the output file */
971
983
H5Fclose (file_id );
984
+ H5Pclose (h_props );
972
985
}
973
986
974
987
/* If we need to start a new file next time, record this */
@@ -1101,6 +1114,12 @@ void lightcone_dump_completed_shells(struct lightcone_props *props,
1101
1114
/* Create the output file for this shell */
1102
1115
hid_t fapl_id = H5Pcreate (H5P_FILE_ACCESS );
1103
1116
1117
+ /* Set the minimal API version to avoid issues with advanced features */
1118
+ herr_t err =
1119
+ H5Pset_libver_bounds (fapl_id , HDF5_LOWEST_FILE_FORMAT_VERSION ,
1120
+ HDF5_HIGHEST_FILE_FORMAT_VERSION );
1121
+ if (err < 0 ) error ("Error setting the hdf5 API version" );
1122
+
1104
1123
/* Set MPI collective mode, if necessary */
1105
1124
int collective = 0 ;
1106
1125
#ifdef WITH_MPI
@@ -1710,8 +1729,13 @@ void lightcone_write_index(struct lightcone_props *props,
1710
1729
check_snprintf (fname , FILENAME_BUFFER_SIZE , "%s/%s_index.hdf5" ,
1711
1730
props -> subdir , props -> basename );
1712
1731
1732
+ hid_t h_props = H5Pcreate (H5P_FILE_ACCESS );
1733
+ herr_t err = H5Pset_libver_bounds (h_props , HDF5_LOWEST_FILE_FORMAT_VERSION ,
1734
+ HDF5_HIGHEST_FILE_FORMAT_VERSION );
1735
+ if (err < 0 ) error ("Error setting the hdf5 API version" );
1736
+
1713
1737
/* Create the file */
1714
- hid_t file_id = H5Fcreate (fname , H5F_ACC_TRUNC , H5P_DEFAULT , H5P_DEFAULT );
1738
+ hid_t file_id = H5Fcreate (fname , H5F_ACC_TRUNC , H5P_DEFAULT , h_props );
1715
1739
1716
1740
/* Write number of MPI ranks and number of files */
1717
1741
hid_t group_id =
@@ -1755,6 +1779,7 @@ void lightcone_write_index(struct lightcone_props *props,
1755
1779
1756
1780
H5Gclose (group_id );
1757
1781
H5Fclose (file_id );
1782
+ H5Pclose (h_props );
1758
1783
}
1759
1784
1760
1785
free (current_file_on_rank );
0 commit comments