How to parallelize this

General OpenMP discussion

How to parallelize this

Postby fre1434 » Thu Jun 17, 2010 8:43 am

I am a newbee, the code I have here like a observer pattern, I'd like to notify multiple client in parallel.
Code is compiled in Vs2008, so no OpenMP 3.0 support.


typedef std::map<int, ListenerT<ParamT> HandlerMap;
HandlerMap::iterator it;
for (it = m_handlers.begin; it != m_handlers.end(); it++)
{
it->second->fire(param);
}
fre1434
 
Posts: 1
Joined: Thu Jun 17, 2010 8:36 am

Re: How to parallelize this

Postby ejd » Thu Jun 17, 2010 10:20 am

Even in OpenMP V3.0 using the relational-op of "!=" is not allowed. Basically you need a "countable" loop, so you need to know the number of elements in m_handlers. This relational-op requirement may change sometime in the future, but for now you will need to reform your loop.
ejd
 
Posts: 1025
Joined: Wed Jan 16, 2008 7:21 am

Re: How to parallelize this

Postby bepperk » Wed Apr 30, 2014 7:57 am

So how can this problem be avoided?
bepperk
 
Posts: 1
Joined: Tue Apr 29, 2014 10:47 am


Return to Using OpenMP

Who is online

Users browsing this forum: Exabot [Bot] and 9 guests