Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mixing Boost FOREACH macro and OpenMP parallelization

I currently have a code (in C) with an outer loop that is OpenMP-parallelized (it operates locally on a shared-memory list). I'm rewriting it in C++, and for many things I found the BOOST_FOREACH macro a very nice syntax as loop construct for iterating over a list, array, etc.

My question is: is there a way I can both use that syntax and parallelize the loop OpenMP-style?

like image 299
F'x Avatar asked Nov 22 '10 15:11

F'x


1 Answers

Copying from the terminal is worth 1 kilowords:

$ g++ a.cpp -I/opt/boost-1.45.0/include -O -fopenmp   
a.cpp: In function ‘int main()’:
a.cpp:12: error: for statement expected before ‘if’
like image 91
F'x Avatar answered Oct 17 '22 11:10

F'x