evil hack to get multithreading working again
future: restructure the multithreading engine to only work on top the sse_compressed enginepull/1/head
parent
c71b0154a1
commit
df17dc23c6
|
@ -21,6 +21,10 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include "operator.h"
|
#include "operator.h"
|
||||||
|
|
||||||
|
namespace NS_Engine_Multithread {
|
||||||
|
class thread; // evil hack to access numTS from multithreading context
|
||||||
|
}
|
||||||
|
|
||||||
class Engine_Extension;
|
class Engine_Extension;
|
||||||
|
|
||||||
class Engine
|
class Engine
|
||||||
|
@ -74,6 +78,8 @@ protected:
|
||||||
vector<Engine_Extension*> m_Eng_exts;
|
vector<Engine_Extension*> m_Eng_exts;
|
||||||
|
|
||||||
ofstream file_et; //excite signal dump file
|
ofstream file_et; //excite signal dump file
|
||||||
|
|
||||||
|
friend class NS_Engine_Multithread::thread; // evil hack to access numTS from multithreading context
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ENGINE_H
|
#endif // ENGINE_H
|
||||||
|
|
|
@ -243,7 +243,7 @@ void thread::operator()()
|
||||||
// excitation finished
|
// excitation finished
|
||||||
|
|
||||||
if (m_threadID == 0)
|
if (m_threadID == 0)
|
||||||
++m_enginePtr->numTS; // only the first thread increments numTS
|
++m_enginePtr->m_RunEngine->numTS; // only the first thread increments numTS
|
||||||
}
|
}
|
||||||
|
|
||||||
m_enginePtr->m_stopBarrier->wait();
|
m_enginePtr->m_stopBarrier->wait();
|
||||||
|
@ -276,7 +276,7 @@ void thread_e_excitation::operator()()
|
||||||
for (size_t n=0;n<m_enginePtr->m_RunEngine->GetExtensionCount();++n)
|
for (size_t n=0;n<m_enginePtr->m_RunEngine->GetExtensionCount();++n)
|
||||||
m_enginePtr->m_RunEngine->GetExtension(n)->Apply2Voltages();
|
m_enginePtr->m_RunEngine->GetExtension(n)->Apply2Voltages();
|
||||||
|
|
||||||
m_enginePtr->ApplyVoltageExcite();
|
m_enginePtr->m_RunEngine->ApplyVoltageExcite();
|
||||||
|
|
||||||
m_enginePtr->m_barrier_VoltExcite->wait(); // continue NS_Engine_Multithread::thread
|
m_enginePtr->m_barrier_VoltExcite->wait(); // continue NS_Engine_Multithread::thread
|
||||||
|
|
||||||
|
@ -286,7 +286,7 @@ void thread_e_excitation::operator()()
|
||||||
for (size_t n=0;n<m_enginePtr->m_RunEngine->GetExtensionCount();++n)
|
for (size_t n=0;n<m_enginePtr->m_RunEngine->GetExtensionCount();++n)
|
||||||
m_enginePtr->m_RunEngine->GetExtension(n)->Apply2Current();
|
m_enginePtr->m_RunEngine->GetExtension(n)->Apply2Current();
|
||||||
|
|
||||||
m_enginePtr->ApplyCurrentExcite();
|
m_enginePtr->m_RunEngine->ApplyCurrentExcite();
|
||||||
|
|
||||||
m_enginePtr->m_barrier_CurrExcite->wait(); // continue NS_Engine_Multithread::thread
|
m_enginePtr->m_barrier_CurrExcite->wait(); // continue NS_Engine_Multithread::thread
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,8 @@ public:
|
||||||
virtual void Init();
|
virtual void Init();
|
||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
|
|
||||||
|
virtual unsigned int GetNumberOfTimesteps() {return m_RunEngine->GetNumberOfTimesteps();}
|
||||||
|
|
||||||
//!Iterate a number of timesteps
|
//!Iterate a number of timesteps
|
||||||
virtual bool IterateTS(unsigned int iterTS);
|
virtual bool IterateTS(unsigned int iterTS);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue