Skip to content

Commit

Permalink
handle only one iteration per execute
Browse files Browse the repository at this point in the history
  • Loading branch information
hpcdgrie committed Apr 24, 2024
1 parent 35f4329 commit d396b66
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
15 changes: 8 additions & 7 deletions lib/vistle/insitu/module/inSituModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,14 @@ bool isPackageComplete(const vistle::message::Buffer &buf)
bool InSituModule::prepare()
{
std::lock_guard<std::mutex> g{m_vistleObjectsMutex};
for (auto &objSet: m_cachedVistleObjects) {
for (auto &obj: objSet) {
updateMeta(obj);
sendMessage(obj);
}
if (m_cachedVistleObjects.empty())
return true;
auto &objSet = m_cachedVistleObjects.front();
for (auto &obj: objSet) {
updateMeta(obj);
sendMessage(obj);
}
m_cachedVistleObjects.clear();
m_cachedVistleObjects.pop();
return true;
}

Expand Down Expand Up @@ -226,7 +227,7 @@ bool InSituModule::cacheVistleObjects()
if (isPackageComplete(buf)) {
vistle::insitu::barrier(m_vistleObjectsComm, m_terminateCommunication);
std::lock_guard<std::mutex> g{m_vistleObjectsMutex};
m_cachedVistleObjects.emplace_back(std::move(vistleObjects));
m_cachedVistleObjects.emplace(std::move(vistleObjects));
return true;
}
vistleObjects.emplace_back(std::move(buf));
Expand Down
3 changes: 2 additions & 1 deletion lib/vistle/insitu/module/inSituModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <string>
#include <vector>
#include <list>
#include <queue>

#include <vistle/insitu/message/MessageHandler.h>

Expand Down Expand Up @@ -49,7 +50,7 @@ class V_INSITUMODULEEXPORT InSituModule: public vistle::Module {
std::unique_ptr<std::thread> m_vistleObjectsThread;
std::mutex m_vistleObjectsMutex;
mpi::communicator m_vistleObjectsComm;
std::vector<std::vector<vistle::message::Buffer>> m_cachedVistleObjects;
std::queue<std::vector<vistle::message::Buffer>> m_cachedVistleObjects;


//..........................................................................
Expand Down

0 comments on commit d396b66

Please sign in to comment.