From a13c1091111d348ffe261c2c63863179d73ff2d0 Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Fri, 30 Mar 2018 16:03:01 +0100 Subject: [PATCH] deterministic initialisation of field metadata --- lib/parallelIO/IldgIOtypes.h | 5 +++-- lib/parallelIO/MetaData.h | 18 ++++++++---------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/lib/parallelIO/IldgIOtypes.h b/lib/parallelIO/IldgIOtypes.h index 5b397e14..281b20f2 100644 --- a/lib/parallelIO/IldgIOtypes.h +++ b/lib/parallelIO/IldgIOtypes.h @@ -136,8 +136,9 @@ struct scidacRecord : Serializable { int, typesize, int, datacount); - scidacRecord() { version =1.0; } - + scidacRecord() + : version(1.0), recordtype(0), colors(0), spins(0), typesize(0), datacount(0) + {} }; //////////////////////// diff --git a/lib/parallelIO/MetaData.h b/lib/parallelIO/MetaData.h index ccc8b18f..55254786 100644 --- a/lib/parallelIO/MetaData.h +++ b/lib/parallelIO/MetaData.h @@ -81,18 +81,16 @@ namespace Grid { std::string, creation_date, std::string, archive_date, std::string, floating_point); - FieldMetaData(void) { - nd=4; - dimension.resize(4); - boundary.resize(4); - scidac_checksuma=0; - scidac_checksumb=0; - checksum=0; - } + // WARNING: non-initialised values might lead to twisted parallel IO + // issues, std::string are fine because they initliase to size 0 + // as per C++ standard. + FieldMetaData(void) + : nd(4), dimension(4,0), boundary(4, ""), data_start(0), + link_trace(0.), plaquette(0.), checksum(0), + scidac_checksuma(0), scidac_checksumb(0), sequence_number(0) + {} }; - - namespace QCD { using namespace Grid;