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
Posts: 8
Joined: Mon Jan 23, 2012 6:37 pm

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: 422
Joined: Thu Jan 08, 2009 10:12 am

Return to Using OpenMP

Who is online

Users browsing this forum: No registered users and 6 guests