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 "operator.h"
|
||||
|
||||
namespace NS_Engine_Multithread {
|
||||
class thread; // evil hack to access numTS from multithreading context
|
||||
}
|
||||
|
||||
class Engine_Extension;
|
||||
|
||||
class Engine
|
||||
|
@ -74,6 +78,8 @@ protected:
|
|||
vector<Engine_Extension*> m_Eng_exts;
|
||||
|
||||
ofstream file_et; //excite signal dump file
|
||||
|
||||
friend class NS_Engine_Multithread::thread; // evil hack to access numTS from multithreading context
|
||||
};
|
||||
|
||||
#endif // ENGINE_H
|
||||
|
|
|
@ -243,7 +243,7 @@ void thread::operator()()
|
|||
// excitation finished
|
||||
|
||||
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();
|
||||
|
@ -276,7 +276,7 @@ void thread_e_excitation::operator()()
|
|||
for (size_t n=0;n<m_enginePtr->m_RunEngine->GetExtensionCount();++n)
|
||||
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
|
||||
|
||||
|
@ -286,7 +286,7 @@ void thread_e_excitation::operator()()
|
|||
for (size_t n=0;n<m_enginePtr->m_RunEngine->GetExtensionCount();++n)
|
||||
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
|
||||
}
|
||||
|
|
|
@ -92,6 +92,8 @@ public:
|
|||
virtual void Init();
|
||||
virtual void Reset();
|
||||
|
||||
virtual unsigned int GetNumberOfTimesteps() {return m_RunEngine->GetNumberOfTimesteps();}
|
||||
|
||||
//!Iterate a number of timesteps
|
||||
virtual bool IterateTS(unsigned int iterTS);
|
||||
|
||||
|
|
Loading…
Reference in New Issue