Skip to content

Commit

Permalink
move MinBlocksInfoMap as a private member and free it up in EndStep()
Browse files Browse the repository at this point in the history
  • Loading branch information
Change72 committed Aug 12, 2024
1 parent 464077b commit d6c5fb8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
11 changes: 5 additions & 6 deletions source/adios2/engine/bp5/BP5Reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@ void BP5Reader::EndStep()
m_BetweenStepPairs = false;
PERFSTUBS_SCOPED_TIMER("BP5Reader::EndStep");
PerformGets();
for (auto &item : MinBlocksInfoMap)
{
delete item.second;
}
MinBlocksInfoMap.clear();
}

std::pair<double, double> BP5Reader::ReadData(adios2::transportman::TransportMan &FileManager,
Expand Down Expand Up @@ -382,7 +387,6 @@ void BP5Reader::PerformRemoteGetsWithKVCache()
};
std::vector<RequestInfo> remoteRequestsInfo;
std::vector<RequestInfo> cachedRequestsInfo;
std::unordered_map<std::string, MinVarInfo *> MinBlocksInfoMap;

for (size_t req_seq = 0; req_seq < GetRequests.size(); req_seq++)
{
Expand Down Expand Up @@ -539,11 +543,6 @@ void BP5Reader::PerformRemoteGetsWithKVCache()
auto &ReqInfo = remoteRequestsInfo[handle_seq];
m_KVCache.ExecuteBatch(ReqInfo.CacheKey.c_str(), 0, 0, nullptr);
}

for (auto& item : MinBlocksInfoMap) {
delete item.second;
}
MinBlocksInfoMap.clear();
}

void BP5Reader::PerformRemoteGets()
Expand Down
1 change: 1 addition & 0 deletions source/adios2/engine/bp5/BP5Reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class BP5Reader : public BP5Engine, public Engine

/* KVCache for remote data */
kvcache::KVCacheCommon m_KVCache;
std::unordered_map<std::string, MinVarInfo *> MinBlocksInfoMap;

/* Fingerprint to verify local validity against remote data */
std::string m_Fingerprint = "";
Expand Down
6 changes: 4 additions & 2 deletions source/adios2/toolkit/format/bp5/BP5Deserializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,10 @@ class BP5Deserializer : virtual public BP5Base
std::mutex mutexDecompress;

public:
VariableBase *GetVariableBaseFromBP5VarRec(void *VarRec) {return static_cast<VariableBase *>(static_cast<BP5VarRec *>(VarRec)->Variable);};

VariableBase *GetVariableBaseFromBP5VarRec(void *VarRec)
{
return static_cast<VariableBase *>(static_cast<BP5VarRec *>(VarRec)->Variable);
};
};

} // end namespace format
Expand Down

0 comments on commit d6c5fb8

Please sign in to comment.