MPI: insert MPI engine into main engines inheritance scheme
new inheritance scheme: [..] -> SSE_Compressed -> MPI -> Multithreading -> [..]
This commit is contained in:
parent
b395546483
commit
8d2d645a26
@ -44,7 +44,7 @@ Engine_Multithread* Engine_Multithread::New(const Operator_Multithread* op, unsi
|
|||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
Engine_Multithread::Engine_Multithread(const Operator_Multithread* op) : Engine_SSE_Compressed(op)
|
Engine_Multithread::Engine_Multithread(const Operator_Multithread* op) : ENGINE_MULTITHREAD_BASE(op)
|
||||||
{
|
{
|
||||||
m_Op_MT = op;
|
m_Op_MT = op;
|
||||||
m_type = SSE;
|
m_type = SSE;
|
||||||
@ -84,7 +84,7 @@ void Engine_Multithread::setNumThreads( unsigned int numThreads )
|
|||||||
void Engine_Multithread::Init()
|
void Engine_Multithread::Init()
|
||||||
{
|
{
|
||||||
m_stopThreads = true;
|
m_stopThreads = true;
|
||||||
Engine_SSE_Compressed::Init();
|
ENGINE_MULTITHREAD_BASE::Init();
|
||||||
|
|
||||||
// initialize threads
|
// initialize threads
|
||||||
m_stopThreads = false;
|
m_stopThreads = false;
|
||||||
@ -144,7 +144,7 @@ void Engine_Multithread::Reset()
|
|||||||
m_stopBarrier = 0;
|
m_stopBarrier = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Engine_SSE_Compressed::Reset();
|
ENGINE_MULTITHREAD_BASE::Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Engine_Multithread::IterateTS(unsigned int iterTS)
|
bool Engine_Multithread::IterateTS(unsigned int iterTS)
|
||||||
@ -241,7 +241,6 @@ void thread::operator()()
|
|||||||
//std::cout << "thread::operator() Parameters: " << m_start << " " << m_stop << std::endl;
|
//std::cout << "thread::operator() Parameters: " << m_start << " " << m_stop << std::endl;
|
||||||
//DBG().cout() << "Thread " << m_threadID << " (" << boost::this_thread::get_id() << ") started." << endl;
|
//DBG().cout() << "Thread " << m_threadID << " (" << boost::this_thread::get_id() << ") started." << endl;
|
||||||
|
|
||||||
|
|
||||||
while (!m_enginePtr->m_stopThreads)
|
while (!m_enginePtr->m_stopThreads)
|
||||||
{
|
{
|
||||||
// wait for start
|
// wait for start
|
||||||
@ -278,6 +277,12 @@ void thread::operator()()
|
|||||||
m_enginePtr->m_IterateBarrier->wait();
|
m_enginePtr->m_IterateBarrier->wait();
|
||||||
// voltage excitation finished
|
// voltage excitation finished
|
||||||
|
|
||||||
|
#ifdef MPI_SUPPORT
|
||||||
|
if (m_threadID==0)
|
||||||
|
m_enginePtr->SendReceiveVoltages();
|
||||||
|
m_enginePtr->m_IterateBarrier->wait();
|
||||||
|
#endif
|
||||||
|
|
||||||
// record time
|
// record time
|
||||||
DEBUG_TIME( m_enginePtr->m_timer_list[boost::this_thread::get_id()].push_back( timer1.elapsed() ); )
|
DEBUG_TIME( m_enginePtr->m_timer_list[boost::this_thread::get_id()].push_back( timer1.elapsed() ); )
|
||||||
|
|
||||||
@ -305,6 +310,12 @@ void thread::operator()()
|
|||||||
m_enginePtr->m_IterateBarrier->wait();
|
m_enginePtr->m_IterateBarrier->wait();
|
||||||
// current excitation finished
|
// current excitation finished
|
||||||
|
|
||||||
|
#ifdef MPI_SUPPORT
|
||||||
|
if (m_threadID==0)
|
||||||
|
m_enginePtr->SendReceiveCurrents();
|
||||||
|
m_enginePtr->m_IterateBarrier->wait();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (m_threadID == 0)
|
if (m_threadID == 0)
|
||||||
++m_enginePtr->numTS; // only the first thread increments numTS
|
++m_enginePtr->numTS; // only the first thread increments numTS
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,14 @@
|
|||||||
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
#ifdef MPI_SUPPORT
|
||||||
|
#define ENGINE_MULTITHREAD_BASE Engine_MPI
|
||||||
|
#include "engine_mpi.h"
|
||||||
|
#else
|
||||||
|
#define ENGINE_MULTITHREAD_BASE Engine_SSE_Compressed
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
class Engine_Multithread;
|
class Engine_Multithread;
|
||||||
|
|
||||||
namespace NS_Engine_Multithread
|
namespace NS_Engine_Multithread
|
||||||
@ -69,7 +77,7 @@ protected:
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
||||||
class Engine_Multithread : public Engine_SSE_Compressed
|
class Engine_Multithread : public ENGINE_MULTITHREAD_BASE
|
||||||
{
|
{
|
||||||
friend class NS_Engine_Multithread::thread;
|
friend class NS_Engine_Multithread::thread;
|
||||||
friend class Engine_CylinderMultiGrid;
|
friend class Engine_CylinderMultiGrid;
|
||||||
|
@ -44,7 +44,7 @@ Engine* Operator_Multithread::CreateEngine() const
|
|||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
Operator_Multithread::Operator_Multithread() : Operator_SSE_Compressed()
|
Operator_Multithread::Operator_Multithread() : OPERATOR_MULTITHREAD_BASE()
|
||||||
{
|
{
|
||||||
m_CalcEC_Start=NULL;
|
m_CalcEC_Start=NULL;
|
||||||
m_CalcEC_Stop=NULL;
|
m_CalcEC_Stop=NULL;
|
||||||
@ -55,7 +55,7 @@ Operator_Multithread::Operator_Multithread() : Operator_SSE_Compressed()
|
|||||||
|
|
||||||
void Operator_Multithread::Init()
|
void Operator_Multithread::Init()
|
||||||
{
|
{
|
||||||
Operator_SSE_Compressed::Init();
|
OPERATOR_MULTITHREAD_BASE::Init();
|
||||||
|
|
||||||
m_CalcEC_Start=NULL;
|
m_CalcEC_Start=NULL;
|
||||||
m_CalcEC_Stop=NULL;
|
m_CalcEC_Stop=NULL;
|
||||||
@ -82,7 +82,7 @@ void Operator_Multithread::Delete()
|
|||||||
void Operator_Multithread::Reset()
|
void Operator_Multithread::Reset()
|
||||||
{
|
{
|
||||||
Delete();
|
Delete();
|
||||||
Operator_SSE_Compressed::Reset();
|
OPERATOR_MULTITHREAD_BASE::Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Operator_Multithread::CalcStartStopLines(unsigned int &numThreads, vector<unsigned int> &start, vector<unsigned int> &stop) const
|
void Operator_Multithread::CalcStartStopLines(unsigned int &numThreads, vector<unsigned int> &start, vector<unsigned int> &stop) const
|
||||||
@ -132,7 +132,7 @@ int Operator_Multithread::CalcECOperator( DebugFlags debugFlags )
|
|||||||
m_thread_group.add_thread( t );
|
m_thread_group.add_thread( t );
|
||||||
}
|
}
|
||||||
|
|
||||||
return Operator_SSE_Compressed::CalcECOperator( debugFlags );
|
return OPERATOR_MULTITHREAD_BASE::CalcECOperator( debugFlags );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Operator_Multithread::Calc_EC()
|
bool Operator_Multithread::Calc_EC()
|
||||||
|
@ -22,7 +22,14 @@
|
|||||||
|
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
|
|
||||||
class Operator_Multithread : public Operator_SSE_Compressed
|
#ifdef MPI_SUPPORT
|
||||||
|
#define OPERATOR_MULTITHREAD_BASE Operator_MPI
|
||||||
|
#include "operator_mpi.h"
|
||||||
|
#else
|
||||||
|
#define OPERATOR_MULTITHREAD_BASE Operator_SSE_Compressed
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class Operator_Multithread : public OPERATOR_MULTITHREAD_BASE
|
||||||
{
|
{
|
||||||
friend class Engine_Multithread;
|
friend class Engine_Multithread;
|
||||||
friend class Operator_Thread;
|
friend class Operator_Thread;
|
||||||
|
Loading…
Reference in New Issue
Block a user