diff --git a/source/adios2/engine/sst/SstReader.cpp b/source/adios2/engine/sst/SstReader.cpp index ecff3755b3..ed24fb7311 100644 --- a/source/adios2/engine/sst/SstReader.cpp +++ b/source/adios2/engine/sst/SstReader.cpp @@ -428,6 +428,7 @@ void SstReader::Init() size_t *Start = NULL; \ size_t *Count = NULL; \ size_t DimCount = 0; \ + int NeedSync; \ \ if (variable.m_SelectionType == \ adios2::SelectionType::BoundingBox) \ @@ -435,20 +436,23 @@ void SstReader::Init() DimCount = variable.m_Shape.size(); \ Start = variable.m_Start.data(); \ Count = variable.m_Count.data(); \ - SstFFSGetDeferred(m_Input, (void *)&variable, \ - variable.m_Name.c_str(), DimCount, Start, \ - Count, data); \ + NeedSync = SstFFSGetDeferred(m_Input, (void *)&variable, \ + variable.m_Name.c_str(), \ + DimCount, Start, Count, data); \ } \ else if (variable.m_SelectionType == \ adios2::SelectionType::WriteBlock) \ { \ DimCount = variable.m_Count.size(); \ Count = variable.m_Count.data(); \ - SstFFSGetLocalDeferred(m_Input, (void *)&variable, \ - variable.m_Name.c_str(), DimCount, \ - variable.m_BlockID, Count, data); \ + NeedSync = SstFFSGetLocalDeferred( \ + m_Input, (void *)&variable, variable.m_Name.c_str(), \ + DimCount, variable.m_BlockID, Count, data); \ + } \ + if (NeedSync) \ + { \ + SstFFSPerformGets(m_Input); \ } \ - SstFFSPerformGets(m_Input); \ } \ if (m_WriterMarshalMethod == SstMarshalBP) \ { \ @@ -456,7 +460,12 @@ void SstReader::Init() /* it's a bad idea in an SST-like environment. But do */ \ /* whatever you do forDoGetDeferred() and then PerformGets() */ \ DoGetDeferred(variable, data); \ - PerformGets(); \ + if (!variable.m_SingleValue) \ + { \ + /* Don't need to do gets if this was a SingleValue (in \ + * metadata) */ \ + PerformGets(); \ + } \ } \ } \ \ diff --git a/source/adios2/toolkit/sst/cp/ffs_marshal.c b/source/adios2/toolkit/sst/cp/ffs_marshal.c index 312777d65c..389ed31c64 100644 --- a/source/adios2/toolkit/sst/cp/ffs_marshal.c +++ b/source/adios2/toolkit/sst/cp/ffs_marshal.c @@ -760,10 +760,9 @@ void NO_SANITIZE_THREAD SstReaderInitFFSCallback( Stream->SetupUpcallReader = Reader; } -extern void SstFFSGetDeferred(SstStream Stream, void *Variable, - const char *Name, size_t DimCount, - const size_t *Start, const size_t *Count, - void *Data) +extern int SstFFSGetDeferred(SstStream Stream, void *Variable, const char *Name, + size_t DimCount, const size_t *Start, + const size_t *Count, void *Data) { struct FFSReaderMarshalBase *Info = Stream->ReaderMarshalData; int GetFromWriter = 0; @@ -778,6 +777,7 @@ extern void SstFFSGetDeferred(SstStream Stream, void *Variable, Var->PerWriterMetaFieldDesc[GetFromWriter]->field_offset; memcpy(Data, IncomingDataBase, Var->PerWriterMetaFieldDesc[GetFromWriter]->field_size); + return 0; // No Sync needed } else { @@ -793,13 +793,14 @@ extern void SstFFSGetDeferred(SstStream Stream, void *Variable, Req->Data = Data; Req->Next = Info->PendingVarRequests; Info->PendingVarRequests = Req; + return 1; // Later Sync needed } } -extern void SstFFSGetLocalDeferred(SstStream Stream, void *Variable, - const char *Name, size_t DimCount, - const int BlockID, const size_t *Count, - void *Data) +extern int SstFFSGetLocalDeferred(SstStream Stream, void *Variable, + const char *Name, size_t DimCount, + const int BlockID, const size_t *Count, + void *Data) { struct FFSReaderMarshalBase *Info = Stream->ReaderMarshalData; int GetFromWriter = 0; @@ -814,6 +815,7 @@ extern void SstFFSGetLocalDeferred(SstStream Stream, void *Variable, Var->PerWriterMetaFieldDesc[GetFromWriter]->field_offset; memcpy(Data, IncomingDataBase, Var->PerWriterMetaFieldDesc[GetFromWriter]->field_size); + return 0; // No Sync needed } else { @@ -829,6 +831,7 @@ extern void SstFFSGetLocalDeferred(SstStream Stream, void *Variable, Req->Data = Data; Req->Next = Info->PendingVarRequests; Info->PendingVarRequests = Req; + return 1; // Later Sync needed } } diff --git a/source/adios2/toolkit/sst/sst.h b/source/adios2/toolkit/sst/sst.h index 3b5a328959..8ae6f77765 100644 --- a/source/adios2/toolkit/sst/sst.h +++ b/source/adios2/toolkit/sst/sst.h @@ -165,14 +165,15 @@ extern void SstFFSMarshal(SstStream Stream, void *Variable, const char *Name, extern void SstFFSMarshalAttribute(SstStream Stream, const char *Name, const char *Type, size_t ElemSize, size_t ElemCount, const void *data); -extern void SstFFSGetDeferred(SstStream Stream, void *Variable, - const char *Name, size_t DimCount, - const size_t *Start, const size_t *Count, - void *Data); -extern void SstFFSGetLocalDeferred(SstStream Stream, void *Variable, - const char *Name, size_t DimCount, - const int BlockID, const size_t *Count, - void *Data); +/* GetDeferred calls return true if need later sync */ +extern int SstFFSGetDeferred(SstStream Stream, void *Variable, const char *Name, + size_t DimCount, const size_t *Start, + const size_t *Count, void *Data); +/* GetDeferred calls return true if need later sync */ +extern int SstFFSGetLocalDeferred(SstStream Stream, void *Variable, + const char *Name, size_t DimCount, + const int BlockID, const size_t *Count, + void *Data); extern SstStatusValue SstFFSPerformGets(SstStream Stream);