C++ list

General OpenMP discussion

C++ list

Postby chameleon » Tue Feb 14, 2012 1:42 pm

How can handle the following code with OpenMP?

Code: Select all
list<T> l;
for (list<T>::iterator z = l.begin(); z != l.end(); z++)
// barrier

Re: C++ list

Postby MarkB » Fri Feb 17, 2012 3:16 am

Provided z is a random access iterator, you can use a #pragma omp parallel for directive for this example. However, this will not create a separate thread for each iteration: it will create a fixed number of threads and share out the iterations amongst these threads.
Posts: 746
Joined: Thu Jan 08, 2009 10:12 am
Location: EPCC, University of Edinburgh

Return to Using OpenMP

Who is online

Users browsing this forum: No registered users and 2 guests