1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2024-11-03 20:54:07 +01:00

Merge pull request #32 from TREX-CoE/fix-text

fix read/flush group for the case of missing blocks
This commit is contained in:
Evgeny Posenitskiy 2021-03-24 13:58:34 +01:00 committed by GitHub
commit d0f0f2ea2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -314,7 +314,10 @@ DEBUG
return NULL;
}
uint64_t size_$group_dset$ = 1;
// workaround for the case of missing blocks in the file
uint64_t size_$group_dset$ = 0;
if ($group$->rank_$group_dset$ != 0) size_$group_dset$ = 1;
for (unsigned int i=0; i<$group$->rank_$group_dset$; i++){
unsigned int j=-1;
@ -462,7 +465,10 @@ trexio_exit_code trexio_text_flush_$group$(const trexio_text_t* file) {
fprintf(f, "rank_$group_dset$ %d\n", $group$->rank_$group_dset$);
uint64_t size_$group_dset$ = 1;
// workaround for the case of missing blocks in the file
uint64_t size_$group_dset$ = 0;
if ($group$->rank_$group_dset$ != 0) size_$group_dset$ = 1;
for (unsigned int i=0; i<$group$->rank_$group_dset$; i++){
fprintf(f, "dims_$group_dset$ %d %ld\n", i, $group$->dims_$group_dset$[i]);
size_$group_dset$ *= $group$->dims_$group_dset$[i];