Skip to content

Commit

Permalink
Merge pull request #2291 from eisenhauer/DuplicateReads
Browse files Browse the repository at this point in the history
Fix extra "performGets" problem
  • Loading branch information
eisenhauer authored May 27, 2020
2 parents 4a85b21 + 1057f64 commit 5f59051
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 24 deletions.
25 changes: 17 additions & 8 deletions source/adios2/engine/sst/SstReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,35 +428,44 @@ void SstReader::Init()
size_t *Start = NULL; \
size_t *Count = NULL; \
size_t DimCount = 0; \
int NeedSync; \
\
if (variable.m_SelectionType == \
adios2::SelectionType::BoundingBox) \
{ \
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) \
{ \
/* DoGetSync() is going to have terrible performance 'cause */ \
/* 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(); \
} \
} \
} \
\
Expand Down
19 changes: 11 additions & 8 deletions source/adios2/toolkit/sst/cp/ffs_marshal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
{
Expand All @@ -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;
Expand All @@ -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
{
Expand All @@ -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
}
}

Expand Down
17 changes: 9 additions & 8 deletions source/adios2/toolkit/sst/sst.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 5f59051

Please sign in to comment.