2010-03-26 11:57:52 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2010 Sebastian Held (sebastian.held@gmx.de)
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2010-03-28 11:10:16 +00:00
|
|
|
//#define ENABLE_DEBUG_TIME
|
|
|
|
|
|
|
|
#ifdef ENABLE_DEBUG_TIME
|
2010-12-06 12:04:37 +00:00
|
|
|
#define DEBUG_TIME(x) x;
|
2010-03-28 11:10:16 +00:00
|
|
|
#else
|
2010-12-06 12:04:37 +00:00
|
|
|
#define DEBUG_TIME(x) ;
|
2010-03-28 11:10:16 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-03-26 11:57:52 +00:00
|
|
|
#include "engine_multithread.h"
|
2010-12-06 14:30:47 +00:00
|
|
|
#include "extensions/engine_extension.h"
|
2010-03-26 11:57:52 +00:00
|
|
|
#include "tools/array_ops.h"
|
|
|
|
|
2010-03-27 21:57:25 +00:00
|
|
|
#include "boost/date_time/posix_time/posix_time.hpp"
|
|
|
|
#include "boost/date_time/gregorian/gregorian.hpp"
|
|
|
|
#include <iomanip>
|
|
|
|
|
2010-03-26 16:24:43 +00:00
|
|
|
//! \brief construct an Engine_Multithread instance
|
|
|
|
//! it's the responsibility of the caller to free the returned pointer
|
2010-05-20 20:02:06 +00:00
|
|
|
Engine_Multithread* Engine_Multithread::New(const Operator_Multithread* op, unsigned int numThreads)
|
2010-03-26 16:24:43 +00:00
|
|
|
{
|
2010-05-20 20:02:06 +00:00
|
|
|
cout << "Create FDTD engine (compressed SSE + multi-threading)" << endl;
|
2010-03-26 16:24:43 +00:00
|
|
|
Engine_Multithread* e = new Engine_Multithread(op);
|
2010-03-30 11:13:00 +00:00
|
|
|
e->setNumThreads( numThreads );
|
2010-03-26 16:24:43 +00:00
|
|
|
e->Init();
|
|
|
|
return e;
|
|
|
|
}
|
|
|
|
|
2011-02-16 14:27:56 +00:00
|
|
|
Engine_Multithread::Engine_Multithread(const Operator_Multithread* op) : ENGINE_MULTITHREAD_BASE(op)
|
2010-03-26 11:57:52 +00:00
|
|
|
{
|
2010-09-02 20:16:37 +00:00
|
|
|
m_Op_MT = op;
|
2010-05-20 20:02:06 +00:00
|
|
|
m_type = SSE;
|
2010-10-06 08:30:55 +00:00
|
|
|
m_IterateBarrier = 0;
|
2010-05-20 20:02:06 +00:00
|
|
|
m_startBarrier = 0;
|
|
|
|
m_stopBarrier = 0;
|
2011-02-23 10:08:24 +00:00
|
|
|
|
|
|
|
#ifdef ENABLE_DEBUG_TIME
|
|
|
|
m_MPI_Barrier = 0;
|
|
|
|
#endif
|
2010-03-26 11:57:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Engine_Multithread::~Engine_Multithread()
|
|
|
|
{
|
2010-03-28 11:10:16 +00:00
|
|
|
#ifdef ENABLE_DEBUG_TIME
|
2010-04-01 14:11:55 +00:00
|
|
|
NS_Engine_Multithread::DBG().cout() << "Engine_Multithread::~Engine_Multithread()" << endl;
|
2010-03-27 21:57:25 +00:00
|
|
|
std::map<boost::thread::id, std::vector<double> >::iterator it;
|
2010-12-06 12:04:37 +00:00
|
|
|
for (it=m_timer_list.begin(); it!=m_timer_list.end(); it++)
|
|
|
|
{
|
2010-04-01 14:11:55 +00:00
|
|
|
NS_Engine_Multithread::DBG().cout() << "*** DEBUG Thread: " << it->first << std::endl;
|
2010-03-27 21:57:25 +00:00
|
|
|
std::vector<double>::iterator it2;
|
2010-12-06 12:04:37 +00:00
|
|
|
for (it2=it->second.begin(); it2<it->second.end();)
|
|
|
|
{
|
2010-04-01 14:11:55 +00:00
|
|
|
NS_Engine_Multithread::DBG().cout() << "after voltage update, before barrier1: " << fixed << setprecision(6) << *(it2++) << std::endl;
|
|
|
|
NS_Engine_Multithread::DBG().cout() << "after barrier1, before barrier2: " << fixed << setprecision(6) << *(it2++) << std::endl;
|
|
|
|
NS_Engine_Multithread::DBG().cout() << "after barrier2, before current update: " << fixed << setprecision(6) << *(it2++) << std::endl;
|
|
|
|
NS_Engine_Multithread::DBG().cout() << "after current update, before barrier3: " << fixed << setprecision(6) << *(it2++) << std::endl;
|
|
|
|
NS_Engine_Multithread::DBG().cout() << "after barrier3: " << fixed << setprecision(6) << *(it2++) << std::endl;
|
2010-03-27 21:57:25 +00:00
|
|
|
}
|
|
|
|
}
|
2010-03-28 11:10:16 +00:00
|
|
|
#endif
|
2010-03-27 21:57:25 +00:00
|
|
|
|
2010-04-01 14:11:55 +00:00
|
|
|
Reset();
|
2010-03-26 11:57:52 +00:00
|
|
|
}
|
|
|
|
|
2010-03-30 11:13:00 +00:00
|
|
|
void Engine_Multithread::setNumThreads( unsigned int numThreads )
|
|
|
|
{
|
|
|
|
m_numThreads = numThreads;
|
|
|
|
}
|
|
|
|
|
2010-03-26 11:57:52 +00:00
|
|
|
void Engine_Multithread::Init()
|
|
|
|
{
|
2010-05-20 20:02:06 +00:00
|
|
|
m_stopThreads = true;
|
2011-02-16 14:27:56 +00:00
|
|
|
ENGINE_MULTITHREAD_BASE::Init();
|
2010-03-26 22:53:05 +00:00
|
|
|
|
|
|
|
// initialize threads
|
2010-04-01 14:11:55 +00:00
|
|
|
m_stopThreads = false;
|
2010-03-30 11:13:00 +00:00
|
|
|
if (m_numThreads == 0)
|
|
|
|
m_numThreads = boost::thread::hardware_concurrency();
|
2010-06-29 10:44:47 +00:00
|
|
|
|
2010-09-03 10:14:25 +00:00
|
|
|
vector<unsigned int> m_Start_Lines;
|
|
|
|
vector<unsigned int> m_Stop_Lines;
|
|
|
|
m_Op_MT->CalcStartStopLines( m_numThreads, m_Start_Lines, m_Stop_Lines );
|
|
|
|
|
2010-06-29 10:44:47 +00:00
|
|
|
cout << "Multithreaded engine using " << m_numThreads << " threads. Utilization: (";
|
2010-10-06 08:30:55 +00:00
|
|
|
m_IterateBarrier = new boost::barrier(m_numThreads); // numThread workers
|
2010-05-09 18:27:17 +00:00
|
|
|
|
2010-03-27 10:32:06 +00:00
|
|
|
m_startBarrier = new boost::barrier(m_numThreads+1); // numThread workers + 1 controller
|
|
|
|
m_stopBarrier = new boost::barrier(m_numThreads+1); // numThread workers + 1 controller
|
2011-02-23 10:08:24 +00:00
|
|
|
#ifdef MPI_SUPPORT
|
|
|
|
m_MPI_Barrier = 0;
|
|
|
|
#endif
|
2010-03-27 10:32:06 +00:00
|
|
|
|
2010-08-25 13:27:59 +00:00
|
|
|
for (unsigned int n=0; n<m_numThreads; n++)
|
|
|
|
{
|
2010-09-03 10:14:25 +00:00
|
|
|
unsigned int start = m_Start_Lines.at(n);
|
|
|
|
unsigned int stop = m_Stop_Lines.at(n);
|
2010-04-01 14:11:55 +00:00
|
|
|
unsigned int stop_h = stop;
|
2010-09-03 10:14:25 +00:00
|
|
|
if (n == m_numThreads-1)
|
|
|
|
{
|
2010-04-01 14:11:55 +00:00
|
|
|
// last thread
|
|
|
|
stop_h = stop-1;
|
2010-06-29 10:44:47 +00:00
|
|
|
cout << stop-start+1 << ")" << endl;
|
2010-04-01 14:11:55 +00:00
|
|
|
}
|
2010-06-29 10:44:47 +00:00
|
|
|
else
|
|
|
|
cout << stop-start+1 << ";";
|
|
|
|
// NS_Engine_Multithread::DBG().cout() << "###DEBUG## Thread " << n << ": start=" << start << " stop=" << stop << " stop_h=" << stop_h << std::endl;
|
2010-04-01 14:11:55 +00:00
|
|
|
boost::thread *t = new boost::thread( NS_Engine_Multithread::thread(this,start,stop,stop_h,n) );
|
2010-03-26 22:53:05 +00:00
|
|
|
m_thread_group.add_thread( t );
|
|
|
|
}
|
2010-10-06 08:30:55 +00:00
|
|
|
|
2010-12-06 12:04:37 +00:00
|
|
|
for (size_t n=0; n<m_Eng_exts.size(); ++n)
|
2010-10-06 08:30:55 +00:00
|
|
|
m_Eng_exts.at(n)->SetNumberOfThreads(m_numThreads);
|
2010-03-26 11:57:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Engine_Multithread::Reset()
|
|
|
|
{
|
2010-09-02 20:04:35 +00:00
|
|
|
if (!m_stopThreads) // prevent multiple invocations
|
|
|
|
{
|
|
|
|
ClearExtensions(); //prevent extensions from interfering with thread reset...
|
2010-04-01 14:11:55 +00:00
|
|
|
|
|
|
|
// stop the threads
|
|
|
|
//NS_Engine_Multithread::DBG().cout() << "stopping all threads" << endl;
|
|
|
|
m_iterTS = 1;
|
|
|
|
m_startBarrier->wait(); // start the threads
|
|
|
|
m_stopThreads = true;
|
|
|
|
m_stopBarrier->wait(); // wait for the threads to finish
|
|
|
|
m_thread_group.join_all(); // wait for termination
|
2010-12-06 12:04:37 +00:00
|
|
|
delete m_IterateBarrier;
|
|
|
|
m_IterateBarrier = 0;
|
|
|
|
delete m_startBarrier;
|
|
|
|
m_startBarrier = 0;
|
|
|
|
delete m_stopBarrier;
|
|
|
|
m_stopBarrier = 0;
|
2010-04-01 14:11:55 +00:00
|
|
|
}
|
2010-03-26 22:53:05 +00:00
|
|
|
|
2011-02-16 14:27:56 +00:00
|
|
|
ENGINE_MULTITHREAD_BASE::Reset();
|
2010-03-26 11:57:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Engine_Multithread::IterateTS(unsigned int iterTS)
|
|
|
|
{
|
2010-03-26 22:53:05 +00:00
|
|
|
m_iterTS = iterTS;
|
2010-04-01 14:11:55 +00:00
|
|
|
|
2010-03-26 22:53:05 +00:00
|
|
|
//cout << "bool Engine_Multithread::IterateTS(): starting threads ...";
|
|
|
|
m_startBarrier->wait(); // start the threads
|
2010-04-01 14:11:55 +00:00
|
|
|
|
2010-03-26 22:53:05 +00:00
|
|
|
//cout << "... threads started";
|
|
|
|
|
|
|
|
m_stopBarrier->wait(); // wait for the threads to finish <iterTS> time steps
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-10-06 08:30:55 +00:00
|
|
|
void Engine_Multithread::DoPreVoltageUpdates(int threadID)
|
|
|
|
{
|
|
|
|
//execute extensions in reverse order -> highest priority gets access to the voltages last
|
2010-12-06 12:04:37 +00:00
|
|
|
for (int n=m_Eng_exts.size()-1; n>=0; --n)
|
2010-10-06 08:30:55 +00:00
|
|
|
{
|
|
|
|
m_Eng_exts.at(n)->DoPreVoltageUpdates(threadID);
|
|
|
|
m_IterateBarrier->wait();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void Engine_Multithread::DoPostVoltageUpdates(int threadID)
|
|
|
|
{
|
|
|
|
//execute extensions in normal order -> highest priority gets access to the voltages first
|
2010-12-06 12:04:37 +00:00
|
|
|
for (size_t n=0; n<m_Eng_exts.size(); ++n)
|
2010-10-06 08:30:55 +00:00
|
|
|
{
|
|
|
|
m_Eng_exts.at(n)->DoPostVoltageUpdates(threadID);
|
|
|
|
m_IterateBarrier->wait();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Engine_Multithread::Apply2Voltages(int threadID)
|
|
|
|
{
|
|
|
|
//execute extensions in normal order -> highest priority gets access to the voltages first
|
2010-12-06 12:04:37 +00:00
|
|
|
for (size_t n=0; n<m_Eng_exts.size(); ++n)
|
2010-10-06 08:30:55 +00:00
|
|
|
{
|
|
|
|
m_Eng_exts.at(n)->Apply2Voltages(threadID);
|
|
|
|
m_IterateBarrier->wait();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Engine_Multithread::DoPreCurrentUpdates(int threadID)
|
|
|
|
{
|
|
|
|
//execute extensions in reverse order -> highest priority gets access to the currents last
|
2010-12-06 12:04:37 +00:00
|
|
|
for (int n=m_Eng_exts.size()-1; n>=0; --n)
|
2010-10-06 08:30:55 +00:00
|
|
|
{
|
|
|
|
m_Eng_exts.at(n)->DoPreCurrentUpdates(threadID);
|
|
|
|
m_IterateBarrier->wait();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Engine_Multithread::DoPostCurrentUpdates(int threadID)
|
|
|
|
{
|
|
|
|
//execute extensions in normal order -> highest priority gets access to the currents first
|
2010-12-06 12:04:37 +00:00
|
|
|
for (size_t n=0; n<m_Eng_exts.size(); ++n)
|
2010-10-06 08:30:55 +00:00
|
|
|
{
|
|
|
|
m_Eng_exts.at(n)->DoPostCurrentUpdates(threadID);
|
|
|
|
m_IterateBarrier->wait();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Engine_Multithread::Apply2Current(int threadID)
|
|
|
|
{
|
|
|
|
//execute extensions in normal order -> highest priority gets access to the currents first
|
2010-12-06 12:04:37 +00:00
|
|
|
for (size_t n=0; n<m_Eng_exts.size(); ++n)
|
2010-10-06 08:30:55 +00:00
|
|
|
{
|
|
|
|
m_Eng_exts.at(n)->Apply2Current(threadID);
|
|
|
|
m_IterateBarrier->wait();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-01 14:11:55 +00:00
|
|
|
//
|
|
|
|
// *************************************************************************************************************************
|
|
|
|
//
|
2010-12-06 12:04:37 +00:00
|
|
|
namespace NS_Engine_Multithread
|
|
|
|
{
|
2010-03-26 22:53:05 +00:00
|
|
|
|
2010-04-01 14:11:55 +00:00
|
|
|
thread::thread( Engine_Multithread* ptr, unsigned int start, unsigned int stop, unsigned int stop_h, unsigned int threadID )
|
2010-03-26 22:53:05 +00:00
|
|
|
{
|
2010-03-30 11:13:00 +00:00
|
|
|
m_enginePtr = ptr;
|
|
|
|
m_start = start;
|
|
|
|
m_stop = stop;
|
|
|
|
m_stop_h = stop_h;
|
2010-04-01 14:11:55 +00:00
|
|
|
m_threadID = threadID;
|
2010-03-26 22:53:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void thread::operator()()
|
|
|
|
{
|
|
|
|
//std::cout << "thread::operator() Parameters: " << m_start << " " << m_stop << std::endl;
|
2010-04-01 14:11:55 +00:00
|
|
|
//DBG().cout() << "Thread " << m_threadID << " (" << boost::this_thread::get_id() << ") started." << endl;
|
2010-03-26 22:53:05 +00:00
|
|
|
|
2010-12-06 12:04:37 +00:00
|
|
|
while (!m_enginePtr->m_stopThreads)
|
|
|
|
{
|
2010-03-26 22:53:05 +00:00
|
|
|
// wait for start
|
2010-04-01 14:11:55 +00:00
|
|
|
//DBG().cout() << "Thread " << m_threadID << " (" << boost::this_thread::get_id() << ") waiting..." << endl;
|
2010-03-26 22:53:05 +00:00
|
|
|
m_enginePtr->m_startBarrier->wait();
|
|
|
|
//cout << "Thread " << boost::this_thread::get_id() << " waiting... started." << endl;
|
|
|
|
|
2010-03-28 11:10:16 +00:00
|
|
|
DEBUG_TIME( Timer timer1 );
|
2010-03-27 21:57:25 +00:00
|
|
|
|
2010-12-06 12:04:37 +00:00
|
|
|
for (unsigned int iter=0; iter<m_enginePtr->m_iterTS; ++iter)
|
2010-03-26 11:57:52 +00:00
|
|
|
{
|
2010-05-09 18:27:17 +00:00
|
|
|
// pre voltage stuff...
|
2010-10-06 08:30:55 +00:00
|
|
|
m_enginePtr->DoPreVoltageUpdates(m_threadID);
|
2010-05-09 18:27:17 +00:00
|
|
|
|
2010-03-26 22:53:05 +00:00
|
|
|
//voltage updates
|
2010-05-20 20:02:06 +00:00
|
|
|
m_enginePtr->UpdateVoltages(m_start,m_stop-m_start+1);
|
2010-03-26 22:53:05 +00:00
|
|
|
|
2010-03-27 21:57:25 +00:00
|
|
|
// record time
|
2010-03-28 11:10:16 +00:00
|
|
|
DEBUG_TIME( m_enginePtr->m_timer_list[boost::this_thread::get_id()].push_back( timer1.elapsed() ); )
|
2010-03-27 21:57:25 +00:00
|
|
|
|
2010-03-26 22:53:05 +00:00
|
|
|
//cout << "Thread " << boost::this_thread::get_id() << " m_barrier1 waiting..." << endl;
|
2010-10-06 08:30:55 +00:00
|
|
|
m_enginePtr->m_IterateBarrier->wait();
|
2010-03-26 22:53:05 +00:00
|
|
|
|
2010-03-27 21:57:25 +00:00
|
|
|
// record time
|
2010-03-28 11:10:16 +00:00
|
|
|
DEBUG_TIME( m_enginePtr->m_timer_list[boost::this_thread::get_id()].push_back( timer1.elapsed() ); )
|
2010-03-27 21:57:25 +00:00
|
|
|
|
2010-05-09 18:27:17 +00:00
|
|
|
//post voltage stuff...
|
2010-10-06 08:30:55 +00:00
|
|
|
m_enginePtr->DoPostVoltageUpdates(m_threadID);
|
|
|
|
m_enginePtr->Apply2Voltages(m_threadID);
|
2010-03-26 22:53:05 +00:00
|
|
|
|
2010-10-02 16:06:38 +00:00
|
|
|
// voltage excitation (E-field excite) by the first thread
|
|
|
|
if (m_threadID==0)
|
|
|
|
m_enginePtr->ApplyVoltageExcite();
|
2010-10-06 08:30:55 +00:00
|
|
|
m_enginePtr->m_IterateBarrier->wait();
|
2010-10-02 16:06:38 +00:00
|
|
|
// voltage excitation finished
|
2010-03-26 22:53:05 +00:00
|
|
|
|
2011-02-16 14:27:56 +00:00
|
|
|
#ifdef MPI_SUPPORT
|
|
|
|
if (m_threadID==0)
|
2011-02-23 10:08:24 +00:00
|
|
|
{
|
|
|
|
if (m_enginePtr->m_MPI_Barrier)
|
|
|
|
m_enginePtr->m_MPI_Barrier->wait();
|
2011-02-16 14:27:56 +00:00
|
|
|
m_enginePtr->SendReceiveVoltages();
|
2011-02-23 10:08:24 +00:00
|
|
|
}
|
2011-02-16 14:27:56 +00:00
|
|
|
m_enginePtr->m_IterateBarrier->wait();
|
|
|
|
#endif
|
|
|
|
|
2010-03-27 21:57:25 +00:00
|
|
|
// record time
|
2010-03-28 11:10:16 +00:00
|
|
|
DEBUG_TIME( m_enginePtr->m_timer_list[boost::this_thread::get_id()].push_back( timer1.elapsed() ); )
|
2010-03-27 21:57:25 +00:00
|
|
|
|
2010-05-09 18:27:17 +00:00
|
|
|
//pre current stuff
|
2010-10-06 08:30:55 +00:00
|
|
|
m_enginePtr->DoPreCurrentUpdates(m_threadID);
|
2010-05-09 18:27:17 +00:00
|
|
|
|
2010-03-26 22:53:05 +00:00
|
|
|
//current updates
|
2010-05-20 20:02:06 +00:00
|
|
|
m_enginePtr->UpdateCurrents(m_start,m_stop_h-m_start+1);
|
2010-03-26 22:53:05 +00:00
|
|
|
|
2010-03-27 21:57:25 +00:00
|
|
|
// record time
|
2010-03-28 11:10:16 +00:00
|
|
|
DEBUG_TIME( m_enginePtr->m_timer_list[boost::this_thread::get_id()].push_back( timer1.elapsed() ); )
|
2010-10-06 08:30:55 +00:00
|
|
|
m_enginePtr->m_IterateBarrier->wait();
|
2010-03-26 22:53:05 +00:00
|
|
|
|
2010-03-27 21:57:25 +00:00
|
|
|
// record time
|
2010-03-28 11:10:16 +00:00
|
|
|
DEBUG_TIME( m_enginePtr->m_timer_list[boost::this_thread::get_id()].push_back( timer1.elapsed() ); )
|
2010-03-27 21:57:25 +00:00
|
|
|
|
2010-05-09 18:27:17 +00:00
|
|
|
//post current stuff
|
2010-10-06 08:30:55 +00:00
|
|
|
m_enginePtr->DoPostCurrentUpdates(m_threadID);
|
|
|
|
m_enginePtr->Apply2Current(m_threadID);
|
2010-05-09 18:27:17 +00:00
|
|
|
|
2010-10-02 16:06:38 +00:00
|
|
|
// current excitation (H-field excite) by the first thread
|
|
|
|
if (m_threadID==0)
|
|
|
|
m_enginePtr->ApplyCurrentExcite();
|
|
|
|
|
2010-10-06 08:30:55 +00:00
|
|
|
m_enginePtr->m_IterateBarrier->wait();
|
2010-10-02 16:06:38 +00:00
|
|
|
// current excitation finished
|
2010-03-26 22:53:05 +00:00
|
|
|
|
2011-02-16 14:27:56 +00:00
|
|
|
#ifdef MPI_SUPPORT
|
|
|
|
if (m_threadID==0)
|
2011-02-23 10:08:24 +00:00
|
|
|
{
|
|
|
|
if (m_enginePtr->m_MPI_Barrier)
|
|
|
|
m_enginePtr->m_MPI_Barrier->wait();
|
2011-02-16 14:27:56 +00:00
|
|
|
m_enginePtr->SendReceiveCurrents();
|
2011-02-23 10:08:24 +00:00
|
|
|
}
|
2011-02-16 14:27:56 +00:00
|
|
|
m_enginePtr->m_IterateBarrier->wait();
|
|
|
|
#endif
|
|
|
|
|
2010-04-01 14:11:55 +00:00
|
|
|
if (m_threadID == 0)
|
2010-05-20 20:02:06 +00:00
|
|
|
++m_enginePtr->numTS; // only the first thread increments numTS
|
2010-03-26 11:57:52 +00:00
|
|
|
}
|
|
|
|
|
2010-03-26 22:53:05 +00:00
|
|
|
m_enginePtr->m_stopBarrier->wait();
|
|
|
|
}
|
2010-04-01 14:11:55 +00:00
|
|
|
|
|
|
|
//DBG().cout() << "Thread " << m_threadID << " (" << boost::this_thread::get_id() << ") finished." << endl;
|
2010-03-26 22:53:05 +00:00
|
|
|
}
|
|
|
|
|
2010-04-01 14:11:55 +00:00
|
|
|
} // namespace
|
|
|
|
|