Skip to content

Commit

Permalink
fix for thread safety
Browse files Browse the repository at this point in the history
  • Loading branch information
eisenhauer committed Jan 28, 2024
1 parent c1aa1d2 commit b0b4987
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 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 @@ -214,12 +214,6 @@ std::pair<double, double> BP5Reader::ReadData(adios2::transportman::TransportMan

// check if subfile is already opened
TP startSubfile = NOW();
static bool checkOnce = true;
if (checkOnce)
{
checkOnce = false;
CheckWriterActive();
}
if (FileManager.m_Transports.count(SubfileNum) == 0)
{
const std::string subFileName =
Expand Down Expand Up @@ -312,6 +306,11 @@ void BP5Reader::PerformLocalGets()
m_WriterMap[m_WriterMapIndex[r2.Timestep]].RankToSubfile[r2.WriterRank]);
};

if (!m_InitialWriterActiveCheckDone)
{
CheckWriterActive();
m_InitialWriterActiveCheckDone = true;
}
// TP start = NOW();
PERFSTUBS_SCOPED_TIMER("BP5Reader::PerformGets");
m_JSONProfiler.Start("DataRead");
Expand Down
2 changes: 2 additions & 0 deletions source/adios2/engine/bp5/BP5Reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ class BP5Reader : public BP5Engine, public Engine

Minifooter m_Minifooter;

bool m_InitialWriterActiveCheckDone = false;

void Init();
void InitParameters();
void InitTransports();
Expand Down

0 comments on commit b0b4987

Please sign in to comment.